# General Relativity/Metric tensor

Recall that a tensor is a linear function which can convert vectors into scalars. Recall also that a distance can be stated as a formula that converts vectors to a scalar. So can we express distance with tensors formulas? Yes, we can.

The first problem comes in, in that tensors are linear functions, but we have some squares in our distance formula. We can deal with this with a mathematical trick. Consider the formula for distance in normal three dimensional Euclidean space using cartesian coordinates:

${\displaystyle \mathbf {d} s^{2}=\mathbf {d} x^{2}+\mathbf {d} y^{2}+\mathbf {d} z^{2}}$

We can rewrite this as:

${\displaystyle \mathbf {d} s^{2}=\delta _{ij}\mathbf {d} x^{i}\mathbf {d} x^{j}}$

Now ${\displaystyle \delta _{ij}}$ is obviously a tensor. What type of tensor is it? Well it takes two contravariant vectors and turns them into a scalar ${\displaystyle ds^{2}}$. So it must be a covariant tensor of rank 2. ${\displaystyle \delta _{ij}}$ is called the Kronecker delta tensor, which is 1 whenever ${\displaystyle i=j}$ and 0 otherwise. In general, instead of components ${\displaystyle \delta _{ij}}$, we have ${\displaystyle g_{ij}}$ :

${\displaystyle \mathbf {d} s^{2}=g_{ij}\mathbf {d} x^{i}\mathbf {d} x^{j}}$

This leads us to a general metric tensor ${\displaystyle g_{ij}}$. As shown earlier, in Euclidean 3-space, ${\displaystyle \left(g_{ij}\right)}$ is simply the Kronecker delta matrix.

And that is the equation of distances in Euclidean three space in tensor notation.

Now let's do special relativity using this notation:

${\displaystyle \mathbf {d} s^{2}=g_{\mu \nu }\mathbf {d} x^{\mu }\mathbf {d} x^{\nu }}$

where the Greek letters just remind us that we are summing over four dimensional space time. Now in the case of special relativity ${\displaystyle g_{\mu \nu }}$ is zero for where ${\displaystyle \mu }$ and ${\displaystyle \nu }$ are different, +1 for the space indices 1,2,3 and ${\displaystyle -c^{2}}$ for the time index. We can call this special matrix ${\displaystyle \eta }$, giving us the formulas:

${\displaystyle \mathbf {d} s^{2}=\eta _{\mu \nu }\mathbf {d} x^{\mu }\mathbf {d} x^{\nu }}$

In general, however, ${\displaystyle g_{ij}}$ will not be a constant. A simple example where we can see that is spherical coordinates, with the metric

${\displaystyle \mathbf {d} s^{2}=\mathbf {d} r^{2}+r^{2}\mathbf {d} \theta ^{2}+r^{2}\sin ^{2}\theta \mathbf {d} \phi ^{2}}$

Here, ${\displaystyle x^{1}=r}$, ${\displaystyle x^{2}=\theta }$, ${\displaystyle x^{3}=\phi }$, ${\displaystyle g_{11}=1}$, ${\displaystyle g_{22}=r^{2}}$, ${\displaystyle g_{33}=r^{2}\sin ^{2}\theta }$, and ${\displaystyle g_{12}=g_{13}=g_{23}=0}$.

Also, a metric may have off-diagonal terms, as in

${\displaystyle \mathbf {d} s^{2}=2\mathbf {d} x\mathbf {d} y}$

It is easy to see that ${\displaystyle g_{12}=1}$ and ${\displaystyle g_{11}=g_{22}=0}$.