The OP specifically asked for a(n ordinary) metric, not a Riemannian metric. While Misha and Paul have given good answers, I think that it's worth pointing out that, if one just takes an arbitrary left-invariant Riemannian metric $ds^2$ on a connected group $G$, there is no guarantee that the associated $dist$ can be computed explicitly. To do this, one would need to be able to integrate the geodesic equations explicitly enough to be able to construct the distance function; unless the Riemannian metric is quite special, this generally can't be done in any explicit way. (See for example, what one has to do to describe the free rotations of a rigid body that has 3 distinct moments of inertia, which is essentially computing the geodesics on $\text{SO}(3)$ with respect to a left-invariant metric that is not bi-invariant.)

*An $\text{SL}(n,\mathbb{R})$-invariant metric on $\text{SL}(n,\mathbb{R})/\text{SO}(n)$:* Since $M=\text{SL}(n,\mathbb{R})/\text{SO}(n)$ is an irreducible Riemannian symmetric space (with nonpositive sectional curvature), it has, up to constant multiples, only one $\text{SL}(n,\mathbb{R})$-invariant Riemannian metric, and the associated $dist$ in this case is not entirely trivial to write down: We can identify each element $m = A\cdot \text{SO}(n)$ with its associated positive definite, unimodular symmetric matrix $s = \sigma(m) = AA^T$, and the formula for $dist(s_1,s_2)$ is as follows: Write
$$
\text{det}(ts_1-s_2) = (t-\lambda_1)(t-\lambda_2)\cdots(t-\lambda_n)
$$
where each $\lambda_i$ is positive and they satisfy $\lambda_1\lambda_2\cdots\lambda_n=1$. Then, up to a constant multiple, one has
$$
dist(s_1,s_2) = \left(\sum_{i=1}^n (\log\lambda_i)^2\right)^{1/2}.
$$
Obviously, writing this out as a function of the entries of $s_1$ and $s_2$ would not be easy. (Of course, this is just one example of the sort of metric that Paul gave; its distinguishing characteristic is that it is the $dist$ of a Riemannian metric, which is not true for Paul's specific example.)

*A left-invariant metric on $\text{SL}(n,\mathbb{R})$:*
Once an invariant metric on $M$ has been defined, one can use it to define a metric on $\text{SL}(n,\mathbb{R})$ itself: First, suppose that $n$ is odd, so that $\text{SL}(n,\mathbb{R})$ acts effectively on $M$. Let $\delta:M\times M\to \mathbb{R}$ be an invariant metric and let $(s_1,\ldots,s_k)\in M\times M\times \cdots \times M$ ($k$ times)
be a $k$-tuple of symmetric matrices with the property that the simultaneous stabilizer of all of the $s_i$ in $\text{SL}(n,\mathbb{R})$ is the identity matrix. (I guess $k=3$ suffices to find such a $k$-tuple; $k=2$ does not.) Set
$$
dist(A,B) = \delta(As_1,Bs_1) + \delta(As_2,Bs_2) + \cdots + \delta(As_k,Bs_k).
$$
This defines a left-invariant metric on $\text{SL}(n,\mathbb{R})$. Note, however, that this is not derived from a *Riemannian* metric. When $n$ is even, $-I_n$ lies in $\text{SL}(n,\mathbb{R})$ and it acts trivially on $M$, so the above construction won't work. However, when $n$ is even, just take the metric induced on $\text{SL}(n,\mathbb{R})$ by its natural embedding into $\text{SL}(n{+}1,\mathbb{R})$, and that will do the job.

To get a Riemannian metric on $\text{SL}(n,\mathbb{R})$ whose $dist$ is computable, one should probably take the left-invariant metric $ds^2 = \text{tr}\bigl((g^{-1}dg)^Tg^{-1}dg\bigr)$. The reason is that this metric is both left-invariant *and* invariant under right action by $\text{SO}(n)$, and the extra symmetries make the geodesic flow explicitly integrable. (There is, of course, no bi-invariant *Riemannian* metric on $\text{SL}(n,\mathbb{R})$.)

A little calculation shows that the $ds^2$-geodesic starting at $I_n$ with velocity $v\in{\frak{sl}}(n,\mathbb{R})$ is given by the formula
$$
\gamma_v(t) = e^{v^Tt}e^{(v-v^T)t},
$$
where $v^T$ represents the transpose of $v$. In particular, one has the 'formula', for $A\in\mathrm{SL}(n,\mathbb{R})$,
$$
dist(I_n,A) = \min\bigl\{\bigl(\text{tr}(v^Tv)\bigr)^{1/2}\ |\ e^{v^T}e^{(v-v^T)} = A\bigr\}.
$$
Unfortunately, computing this $dist$ more explicitly is a challenge. By left-invariance, of course, one has $dist(A,B) = dist(I_n,A^{-1}B)$, so this determines the metric completely.

Computing $dist$ explicitly is nontrivial even in the case $n=2$. In this case, one has the fortunate circumstance that, unless $\det(v)>0$, there are no conjugate points along the geodesic $\gamma_v$, and, when $\det(v)>0$, the first conjugate point is at $t = \pi/\sqrt{\det(v)}$. However, describing the exact cut locus of $I_n$ in ${\frak{sl}}(n,\mathbb{R})$ with respect to $ds^2$ does not seem to be trivial. This does not seem to be a particularly good way to construct a left-invariant metric on $\text{SL}(2,\mathbb{R})$. Nevertheless, it's not hopeless. If I have time, I'll add a little note to this describing what one can say.

istrue, however, that a Riemannian metric does define a distance function, right? So I believe your answer is a full positive answer to the question, right? $\endgroup$ – Deane Yang Sep 28 '12 at 2:342more comments