# Ricci tensor given through the metric

As mentioned in the comments calculating algebraic expressions for the Ricci tensor containing the metric, its inverse and its first and second derivatives is straight forward using computer algebra.

The most arbitrary metric $$g_{\alpha\beta}=g_{\beta\alpha}$$ has 10 independent components which are functions of four coordinates $\left\{x_0,x_1,x_2,x_3\right\}$: $$g_{\alpha\beta}(x_0,x_1,x_2,x_3).$$ The metric has an inverse with 10 independent components $$g^{\alpha\beta}=g^{\beta\alpha}.$$

The metric has 40 independent first partial derivatives $$g_{\alpha\beta,\gamma}$$ and 100 independent second partial derivatives (100 and not 160 because of the the symmetry of second derivatives) $$g_{\alpha\beta,\gamma\delta}=g_{\alpha\beta,\delta\gamma}.$$

Using those ingredients ($g_{\alpha\beta}$, $g^{\alpha\beta}$, $g_{\alpha\beta,\gamma}$ and $g_{\alpha\beta,\gamma\delta}$) one can compute 21 components of the Riemann tensor $R_{\alpha\beta\gamma\delta}$. One could eliminate one of those 21 components using the first Bianchi identity.

Just to give one example in this post: $R_{0102}$ has 1510 terms: 4 second derivatives and the rest are contractions of Christoffel symbols:

The Ricci tensor can be constructed from the contraction $$R_{\alpha\beta}=R^\mu_{\,\,\alpha\mu\beta}$$ so it contains the components of the inverse metric an those 21 Riemann tensors:

Writing $R_{\alpha\beta}$ out in terms of $g$ only becomes super messy in case of $R_{01}$ we are talking about 8711 terms. I have no idea how to visualize such an expression here at SE. I have uploaded a PDF (careful it is rather large) of $R_{01}$ here.

I also uploaded *.m* files containing all 10 independent components of $R_{\alpha\beta}$ Rij.m and the 21 components of $R_{\alpha\beta\gamma\delta}$ Rijkl.m.

As pointed out in the comment of the original question those expressions have only very very limited use. But maybe some conclusions:

- We see that a tensor notation in sum convention is a very very elegant way to formulate those expressions.
- This elegant notation masks the general complexity of those expressions.
- The explicit expressions in terms of $g$ illustrate the utmost importance of symmetries and a good coordinate choice for a given problem.
- To work with the field equations symmetries and/or advanced methods of Numerical Relativity are necessary because in a naive form the expressions and equations are just to complicated. Such a "brute force" approach of formulating/ printing out the field equations of General Relativity is doomed to fail.

Probably the question is already not relevant for the TS, but it might be of interest for others.

\begin{equation} \begin{aligned} R_{\mu \nu}=&\frac{1}{2}\, {\partial}_{\rho}{{g}^{\rho \sigma}}\, {\partial}_{\nu}{{g}_{\mu \sigma}}\, + \frac{1}{2}\, {\partial}_{\rho}{{g}^{\rho \sigma}}\, {\partial}_{\mu}{{g}_{\nu \sigma}}\, - \frac{1}{2}\, {\partial}_{\rho}{{g}^{\rho \sigma}}\, {\partial}_{\sigma}{{g}_{\mu \nu}}\, + \frac{1}{2}\, {g}^{\rho \sigma} {\partial}_{\nu \rho}{{g}_{\mu \sigma}}\, + \frac{1}{2}\, {g}^{\rho \sigma} {\partial}_{\mu \rho}{{g}_{\nu \sigma}}\,\\ & - \frac{1}{2}\, {g}^{\rho \sigma} {\partial}_{\rho \sigma}{{g}_{\mu \nu}}\, - \frac{1}{2}\, {\partial}_{\nu}{{g}^{\rho \sigma}}\, {\partial}_{\mu}{{g}_{\rho \sigma}}\, - \frac{1}{2}\, {g}^{\rho \sigma} {\partial}_{\mu \nu}{{g}_{\rho \sigma}}\, + \frac{1}{4}\, {g}^{\kappa \lambda} {\partial}_{\nu}{{g}_{\mu \kappa}}\, {g}^{\rho \sigma} {\partial}_{\lambda}{{g}_{\rho \sigma}}\, + \frac{1}{4}\, {g}^{\kappa \lambda} {\partial}_{\mu}{{g}_{\nu \kappa}}\, {g}^{\rho \sigma} {\partial}_{\lambda}{{g}_{\rho \sigma}}\, \\ & - \frac{1}{4}\, {g}^{\kappa \lambda} {\partial}_{\kappa}{{g}_{\mu \nu}}\, {g}^{\rho \sigma} {\partial}_{\lambda}{{g}_{\rho \sigma}}\, - \frac{1}{4}\, {g}^{\kappa \lambda} {\partial}_{\mu}{{g}_{\kappa \rho}}\, {g}^{\rho \sigma} {\partial}_{\nu}{{g}_{\lambda \sigma}}\, - \frac{1}{2}\, {g}^{\kappa \lambda} {\partial}_{\kappa}{{g}_{\mu \rho}}\, {g}^{\rho \sigma} {\partial}_{\sigma}{{g}_{\nu \lambda}}\, + \frac{1}{2}\, {g}^{\kappa \lambda} {\partial}_{\kappa}{{g}_{\mu \rho}}\, {g}^{\rho \sigma} {\partial}_{\lambda}{{g}_{\nu \sigma}} \end{aligned} \end{equation}

I obtained this using Cadabra computer algebra program. It produces output as a LaTeX file. The notations are as follows \begin{equation} \begin{aligned} R^{\rho}{}_{\sigma \mu \nu}& = \partial_{\mu}{\Gamma_{\nu \sigma}{}^{\rho}}- \partial_{\nu}{\Gamma_{\mu \sigma}{}^{\rho}} +\Gamma_{\mu \kappa}{}^{\rho}\Gamma_{\nu \sigma}{}^{\kappa}-\Gamma_{\nu \kappa}{}^{\rho}\Gamma_{\mu \sigma}{}^{\kappa},\\ \Gamma_{\mu \nu}{}^{\rho} &= \frac{1}{2}g^{\rho \sigma}\big(\partial_{\mu}{g_{\sigma \nu}} +\partial_{\nu}{g_{\sigma \mu}} -\partial_{\sigma}{g_{\mu \nu}}\big). \end{aligned} \end{equation} I haven't tried any simplifications of the result using the properties of the metric $g_{\mu\nu}$.