# General Relativity - (numerically) compute the metric from the stress-energy tensor?

I am new to GR and I am having trouble understanding how one goes back and forth between the metric $$g_{\mu\nu}$$ and the stress-energy tensor $$T_{\mu\nu}$$.

First, have a look at the following post. It provides an "easy" method for calculating $$T_{\mu\nu}$$ given a metric $$g_{\mu\nu}$$:

How does one reverse this formula? That is, given a stress-energy tensor $$T_{\mu\nu}$$ (or even more specifically, a distribution of mass-energy $$T_{00}$$), how do you compute $$g_{\mu\nu}$$? Of course it's technically possible to simply expand Einstein's equations by rewriting $$R_{\mu\nu}$$ in terms of $$\Gamma^{\lambda}_{\mu\nu}$$, which can then be expanded in terms of derivatives of $$g_{\mu\nu}$$, but the result would be a large, disgusting sum of gross PDEs. If it is possible to avoid that, I would love to know.

I understand that this is a bit unorthodox, since in most applications, it suffices to simply find $$\Gamma^{\lambda}_{\mu\nu}$$ from $$R_{\mu\nu}$$ in order to derive the equations of motion.

I want to know because, ultimately, I would like to create a Mathematica notebook in which the input would be an arbitrary geometry for the the mass-energy density and it would output the metric. It seems relatively straightforward but I cannot find anything online as a guide.

• Well, by solving EFE. Commented May 3, 2019 at 22:11
• "It seems relatively straightforward" Please don't take this the wrong way, but this statement is as wrong as it gets. Solving the Einstein equations is extremely complicated. If an analytic solution exists, you kinda have to find it by educated guessing. Numerically solving the equations in interesting scenarios has only been possible in the last fifteen years or so. You won't be able to just do it with a Mathematica notebook. Commented May 3, 2019 at 23:17

You can't invert the relation to find $$g_{\mu\nu}$$ from $$T_{\mu\nu}$$. The metric uniquely determines the stress tensor, but not vice versa. For example, the Minkowski metric and the Schwarzschild metric are not equivalent, but both solve $$G_{\mu\nu}=8\pi T_{\mu\nu}=0$$.

To solve for the metric in GR, you need to solve the differential equations of motion, one of which is Einstein's equation. You can't just specify the stress tensor and expect the metric to pop out.

There's an important thing to note, though, about trying to find the metric. It's a common misconception that GR is done by "solving Einstein's equation for the metric". Except in case of vacuum solutions, it's actually more complicated than that, because you need to solve the joint matter-gravitational equations of motion. This is a set of coupled differential equations for the metric and matter variables, and Einstein's equation is only one of these coupled equations. There's some more detail about this in my annoying long (sorry) related answer here.

(In actuality, you really never solve the joint equations of motion either, because it's too hard. You almost always just choose a metric and see what the stress tensor says about the matter content. But you would have to, to do what you're asking.)

(Alternately, in the case of your specific question, you would at the very least need some additional assumptions to make the inverse unique --- but that would be arbitrary, and is not how things are done.)