# Matrix representations of tensors

I've been trying to teach myself general relativity, and I always get stuck at the same point: I don't really understand what the metric tensor is. Unless I'm incorrect, and please correct me if I'm wrong, I realize that it defines a geodesic distance in some coordinate system over some manifold. However, what ultimately confuses me is the calculation.

For example, the metric tensor in Euclidean space is defined to be $g_{ij}= \frac{\partial x^k}{ \partial x^i}\frac{\partial x^l}{ \partial x^j}$, according to Wikipedia anyway (https://en.wikipedia.org/wiki/Metric_tensor). But doesn't this have a matrix representation? If so, I have absolutely no idea what it would look like. Can someone give an example.

Furthermore, I know that the metric tensor can be used to raise or lower the index of an arbitrary tensor. For example, considering the Riemannian curvature tensor, $R_{ijkl} = g_{kp}R^p_{ijl}$. Is there a matrix equation (using matrix representation) that explains why this happened. I have read (Using metric to raise and lower indices) and understand that it has to do with a change from covariant to covariant basis. But if $g_{kp}$ is a matrix with a certain number of rows and columns, mustn't $R^p_{ijl}$ also be a matrix of rows and columns? Did any of them disappear upon taking the transformation? This does not seem possible. So what is the difference between a matrix of covariant elements versus contravariant elements? Please use matrices to explain and not Einstein summation notation.

Secondly, what does the inverse of the metric tensor look like and how does it cancel out indeces of another matrix? For example, the Ricci tensor is given by $R_{ik} = g^{jl}R_{ijkl}$. What happened to those elements in the matrix $R_{ijkl}$ that look like $a_{ijkl}$?

Lastly, can anyone give a matrix representation of a Christoffel symbol $\Gamma^k_{ij} = \frac{1}{2} g^{kl} \frac{ \partial g_{jl}}{ \partial x^i}+ \frac{ \partial g_{il}}{ \partial x^j}− \frac{ \partial g_{ij}}{ \partial x^l}$? What does the partial derivative of the matrix $g_{jl}$ in terms of $x^i$ look like? How does the matrix $g_{jl}$ differ from the matrix $g_{il}$ and from the matrix $g_{ij}$? Are they somehow the same matrix?

What I am ultimately trying to figure out is how to do actual calculations using tensors. Ultimately, there must be a list of numbers representing coordinates in a given reference frame. But how do these numbers interact with one another when indeces are changed and canceled out? If anyone can shed light on this, using examples with numbers if possible, I would greatly appreciate it.

This is a terrific question. I will try to answer all of your concerns. In general, you should be aware of a few things. First, when we say things like $g_{ij}$, $i$ and $j$ are just placeholders for integers. So it doesn't matter what letters are in the subscript, they mean the same thing. Second, not all tensors can be represented as matrices. Only tensors with two indices have a matrix representation.

The metric tensor does define a geodesic distance, but this is not its only purpose, or even its primary purpose. The main idea of the metric tensor is to show how the coordinates on a manifold relate to each other at each point in the manifold. In some manifolds, like Euclidean space or a cylinder, each point is essentially the same, so the metric tensor is constant, but in most manifolds, the metric tensor is a function (called a tensor field) over the manifold, which depends on the coordinates of the manifold.

The example you gave of the metric tensor in Euclidean space doesn't seem quite right. Specifically, I notice that the indices $k$ and $l$ appear only once in the equation (each index should appear twice in a tensor equation). This equation does look like the formula for converting the metric tensor from one coordinate system to another, which is $$g_{ij}=\frac{\partial x^k}{\partial x^i}\frac{\partial x^l}{\partial x^j}g_{kl}.$$ Here, we have a coordinate system for a 2-manifold characterized by coordinates $x_k$ and $x_l$ with their corresponding metric tensor $g_{kl}$. This formula shows how to convert to the metric tensor for the coordinate system characterized by coordinates $x_i$ and $x_j$. This is like changing from Euclidean to spherical or cylindrical coordinates in $\mathbb R^3$.

Your real question in your second paragraph is how to represent a metric tensor as a matrix. This is quite easy. If your manifold has $n$ dimensions (and thus $n$ coordinates), the metric tensor can be represented by an $n\times n$ matrix where the element of the matrix in the $i^{\text{th}}$ row and $j^{\text{th}}$ column is $g_{ij}$. In $\mathbb R^2$, the matrix representation is $$g_{ij}\doteq\left(\begin{array}{cc} 1 & 0\\ 0 & 1\\ \end{array}\right).$$ You may wonder where this came from. The simplest way to explicitly determine the elements of the metric tensor, and a favorite method in general relativity, is to think about the line element. The line element refers to the infinitesimal distance along a path with respect to the coordinate system. In Euclidean space this is easy because we have the Pythagorean Theorem: $$ds^2=dx^2+dy^2.$$ The line element (called $ds^2$; think of the squared as part of the symbol) is the amount changed in $x$ squared plus the amount changed in $y$ squared. In general, a line element for a 2-manifold would look like this: $$ds^2=g_{11}dx^2+g_{12}dx\,dy+g_{22}dy^2.$$ (notice that the metric tensor is always symmetric, so $g_{12}=g_{21}$.) The terms that involve change along more than one coordinate are called off-diagonal terms because they correspond to off-diagonal elements in the matrix representation. Notice that in Euclidean space, there are no off diagonal terms, so the corresponding matrix is diagonal. Since in Euclidean space, $dx^2$ and $dy^2$ both have coefficients of $1$ in the line element, there are ones in the diagonal.

First of all, if a tensor has more that two indices, than it cannot be represented by a matrix. Of course, we could represent it as a "higher dimensional box of numbers," but then writing things down on a two dimensional piece of paper gets tricky, which is why we have things like Einstein notation. Nevertheless, we shall press on. To do so, we must think of matrices a linear operators. A matrix equation like $Ax=b$ must be read as "$A$ acts on $x$ to give $b$. In this way, the matrix acts on one vector and returns another vector. But where do these vectors come from? They come from the tangent space at a point in the manifold. Whenever we have a tangent space, there is a cotangent space (or dual space) to go with it. A tensor like $A^{ij}$ has a matrix representation which acts on a covector to give another covector. A mixed variance tensor like $R^i_j$ acts on a covector to give a vector or acts on a vector to give a covector. As for the numbers of rows and columns, they should always be $n$ (and $n=4$ in general relativity).

The inverse metric is represented quite literally as the inverse matrix of the metric representation. As for the canceling, this is the same as a reduction in the number of indices when row vector is multiplied by a matrix. The elements that look like $a_{ijkl}$ are multiplied by elements from the inverse metric and added together to get something called $a_{ik}$. Again, $R_{ijkl}$ is not represented by a matrix.

The Christoffel symbol is not a tensor (notice it is not called the Christoffel tensor), but it could still be represented by a "3D box of numbers." The matrices $g_{jl}$, $g_{il}$, and $g_{ij}$ are all the same, but when we assign specific values to $i$, $j$, and $l$, these terms reference different elements of the matrix. Each element $g_{jl}$ is a function of $x^i$ for each coordinate $x^i$. The derivative of $g_{jl}$ with respect to $x_i$ is the standard partial derivative of the $jl$ element of the metric tensor with respect to the $i^\text{th}$ coordinate.

Don't get too hung up on numbers and matrices. Relativists realized a long time ago that this way of thinking is not helpful. Things like Einstein notation are helpful for simplifying calculations. You ask about how elements are affected when indices are changed or cancelled. Just write down the tensor equation in Einstein notation with the appropriate sums and see what happens. It may concern you now, but soon you will not worry so much. Einstein notation is very reliable and won't lead you astray.

I hesitate to give examples in terms of numbers because such calculations are usually very long. In my first relativity class, we were given a metric tensor, and asked to calculate the Ricci tensor, so we first had to calculate Christoffels, then Riemann, then Ricci. I think I used six sheets of paper front and back. But I just did the calculations the way the Einstein notation directs, and it turned out alright. My professor said that he gave us that assignment so we would appreciate the hard work of early relativists. After that, he allowed us to use a computer algebra system.

Edit:

One more thing. If you tried to do the calculations using matrices and "higher dimensional boxes," you would essentially be doing Einstein notation anyway.

• That was an outstanding answer @AlexS. Thank you. – nycguy92 Aug 27 '15 at 17:35
• I'd like to ask for one numeric example if you don't mind. You rewrote my formula for the metric tensor as $g_{ij}= \frac{\partial x^k}{ \partial x^i}\frac{\partial x^l}{ \partial x^j} g_{kl}$. You then gave the metric tensor as the identity matrix and then said that such a transformation could be thought of in terms of changing basis from Cartesian to spherical coordinates. Can you give an example showing how the Einstein summation form converts the "1's" in the identity matrix to spherical coordinates? I don't see how it's analogous to the change of basis typically done in matrix algebra. – nycguy92 Aug 27 '15 at 17:37