# Checking that Kerr metric is a solution of Einstein equation

This Jupyter/SageMath notebook is relative to the lectures Physics of black holes

These computations are based on SageManifolds (version 1.2, as included in SageMath 8.2 and higher versions)

Click here to download the worksheet file (ipynb format). To run it, you must start SageMath with the Jupyter notebook, with the command sage -n jupyter

NB: a version of SageMath at least equal to 8.2 is required to run this worksheet:

In [1]:
version()

'SageMath version 8.2, Release Date: 2018-05-05'

First we set up the notebook to display mathematical objects using LaTeX formatting:

In [2]:
%display latex


To speed up computations, we ask for running them in parallel on 8 threads:

In [3]:
Parallelism().set(nproc=8)


## Spacetime

We declare the spacetime manifold $M$:

In [4]:
M = Manifold(4, 'M', structure='Lorentzian')
print(M)

4-dimensional Lorentzian manifold M

and the Boyer-Lindquist coordinates $(t,r,\theta,\phi)$ as a chart on $M$:

In [5]:
XBL.<t,r,th,ph> = M.chart(r't r th:(0,pi):\theta ph:(0,2*pi):\phi')
XBL

$\left(M,(t, r, {\theta}, {\phi})\right)$
In [6]:
XBL.coord_range()

$t :\ \left( -\infty, +\infty \right) ;\quad r :\ \left( -\infty, +\infty \right) ;\quad {\theta} :\ \left( 0 , \pi \right) ;\quad {\phi} :\ \left( 0 , 2 \, \pi \right)$

## Kerr metric

We define the metric $g$ by its components w.r.t. the Boyer-Lindquist coordinates:

In [7]:
g = M.metric()
m, a = var('m a')
rho2 = r^2 + (a*cos(th))^2
Delta = r^2 - 2*m*r + a^2
g[0,0] = -(1 - 2*m*r/rho2)
g[0,3] = -2*a*m*r*sin(th)^2/rho2
g[1,1] = rho2/Delta
g[2,2] = rho2
g[3,3] = (r^2 + a^2 + 2*m*r*(a*sin(th))^2/rho2)*sin(th)^2
g.display()

$g = \left( \frac{2 \, m r}{a^{2} \cos\left({\theta}\right)^{2} + r^{2}} - 1 \right) \mathrm{d} t\otimes \mathrm{d} t + \left( -\frac{2 \, a m r \sin\left({\theta}\right)^{2}}{a^{2} \cos\left({\theta}\right)^{2} + r^{2}} \right) \mathrm{d} t\otimes \mathrm{d} {\phi} + \left( \frac{a^{2} \cos\left({\theta}\right)^{2} + r^{2}}{a^{2} - 2 \, m r + r^{2}} \right) \mathrm{d} r\otimes \mathrm{d} r + \left( a^{2} \cos\left({\theta}\right)^{2} + r^{2} \right) \mathrm{d} {\theta}\otimes \mathrm{d} {\theta} + \left( -\frac{2 \, a m r \sin\left({\theta}\right)^{2}}{a^{2} \cos\left({\theta}\right)^{2} + r^{2}} \right) \mathrm{d} {\phi}\otimes \mathrm{d} t + {\left(\frac{2 \, a^{2} m r \sin\left({\theta}\right)^{2}}{a^{2} \cos\left({\theta}\right)^{2} + r^{2}} + a^{2} + r^{2}\right)} \sin\left({\theta}\right)^{2} \mathrm{d} {\phi}\otimes \mathrm{d} {\phi}$
In [8]:
g.display_comp()

$\begin{array}{lcl} g_{ \, t \, t }^{ \phantom{\, t}\phantom{\, t} } & = & \frac{2 \, m r}{a^{2} \cos\left({\theta}\right)^{2} + r^{2}} - 1 \\ g_{ \, t \, {\phi} }^{ \phantom{\, t}\phantom{\, {\phi}} } & = & -\frac{2 \, a m r \sin\left({\theta}\right)^{2}}{a^{2} \cos\left({\theta}\right)^{2} + r^{2}} \\ g_{ \, r \, r }^{ \phantom{\, r}\phantom{\, r} } & = & \frac{a^{2} \cos\left({\theta}\right)^{2} + r^{2}}{a^{2} - 2 \, m r + r^{2}} \\ g_{ \, {\theta} \, {\theta} }^{ \phantom{\, {\theta}}\phantom{\, {\theta}} } & = & a^{2} \cos\left({\theta}\right)^{2} + r^{2} \\ g_{ \, {\phi} \, t }^{ \phantom{\, {\phi}}\phantom{\, t} } & = & -\frac{2 \, a m r \sin\left({\theta}\right)^{2}}{a^{2} \cos\left({\theta}\right)^{2} + r^{2}} \\ g_{ \, {\phi} \, {\phi} }^{ \phantom{\, {\phi}}\phantom{\, {\phi}} } & = & {\left(\frac{2 \, a^{2} m r \sin\left({\theta}\right)^{2}}{a^{2} \cos\left({\theta}\right)^{2} + r^{2}} + a^{2} + r^{2}\right)} \sin\left({\theta}\right)^{2} \end{array}$

The inverse metric:

In [9]:
g.inverse()[:]

$\left(\begin{array}{rrrr} -\frac{2 \, a^{2} m r \sin\left({\theta}\right)^{2} + a^{2} r^{2} + r^{4} + {\left(a^{4} + a^{2} r^{2}\right)} \cos\left({\theta}\right)^{2}}{a^{2} r^{2} - 2 \, m r^{3} + r^{4} + {\left(a^{4} - 2 \, a^{2} m r + a^{2} r^{2}\right)} \cos\left({\theta}\right)^{2}} & 0 & 0 & -\frac{2 \, a m r}{a^{2} r^{2} - 2 \, m r^{3} + r^{4} + {\left(a^{4} - 2 \, a^{2} m r + a^{2} r^{2}\right)} \cos\left({\theta}\right)^{2}} \\ 0 & \frac{a^{2} - 2 \, m r + r^{2}}{a^{2} \cos\left({\theta}\right)^{2} + r^{2}} & 0 & 0 \\ 0 & 0 & \frac{1}{a^{2} \cos\left({\theta}\right)^{2} + r^{2}} & 0 \\ -\frac{2 \, a m r}{a^{2} r^{2} - 2 \, m r^{3} + r^{4} + {\left(a^{4} - 2 \, a^{2} m r + a^{2} r^{2}\right)} \cos\left({\theta}\right)^{2}} & 0 & 0 & \frac{a^{2} \cos\left({\theta}\right)^{2} - 2 \, m r + r^{2}}{2 \, a^{2} m r \sin\left({\theta}\right)^{4} - {\left(2 \, a^{2} m r - a^{2} r^{2} + 2 \, m r^{3} - r^{4} - {\left(a^{4} + a^{2} r^{2}\right)} \cos\left({\theta}\right)^{2}\right)} \sin\left({\theta}\right)^{2}} \end{array}\right)$

The Christoffel symbols:

In [10]:
g.christoffel_symbols_display()

$\begin{array}{lcl} \Gamma_{ \phantom{\, t} \, t \, r }^{ \, t \phantom{\, t} \phantom{\, r} } & = & \frac{a^{2} m r^{2} + m r^{4} - {\left(a^{4} m + a^{2} m r^{2}\right)} \cos\left({\theta}\right)^{2}}{a^{2} r^{4} - 2 \, m r^{5} + r^{6} + {\left(a^{6} - 2 \, a^{4} m r + a^{4} r^{2}\right)} \cos\left({\theta}\right)^{4} + 2 \, {\left(a^{4} r^{2} - 2 \, a^{2} m r^{3} + a^{2} r^{4}\right)} \cos\left({\theta}\right)^{2}} \\ \Gamma_{ \phantom{\, t} \, t \, {\theta} }^{ \, t \phantom{\, t} \phantom{\, {\theta}} } & = & -\frac{2 \, a^{2} m r \cos\left({\theta}\right) \sin\left({\theta}\right)}{a^{4} \cos\left({\theta}\right)^{4} + 2 \, a^{2} r^{2} \cos\left({\theta}\right)^{2} + r^{4}} \\ \Gamma_{ \phantom{\, t} \, r \, {\phi} }^{ \, t \phantom{\, r} \phantom{\, {\phi}} } & = & -\frac{{\left(a^{3} m r^{2} + 3 \, a m r^{4} - {\left(a^{5} m - a^{3} m r^{2}\right)} \cos\left({\theta}\right)^{2}\right)} \sin\left({\theta}\right)^{2}}{a^{2} r^{4} - 2 \, m r^{5} + r^{6} + {\left(a^{6} - 2 \, a^{4} m r + a^{4} r^{2}\right)} \cos\left({\theta}\right)^{4} + 2 \, {\left(a^{4} r^{2} - 2 \, a^{2} m r^{3} + a^{2} r^{4}\right)} \cos\left({\theta}\right)^{2}} \\ \Gamma_{ \phantom{\, t} \, {\theta} \, {\phi} }^{ \, t \phantom{\, {\theta}} \phantom{\, {\phi}} } & = & -\frac{2 \, {\left(a^{5} m r \cos\left({\theta}\right) \sin\left({\theta}\right)^{5} - {\left(a^{5} m r + a^{3} m r^{3}\right)} \cos\left({\theta}\right) \sin\left({\theta}\right)^{3}\right)}}{a^{6} \cos\left({\theta}\right)^{6} + 3 \, a^{4} r^{2} \cos\left({\theta}\right)^{4} + 3 \, a^{2} r^{4} \cos\left({\theta}\right)^{2} + r^{6}} \\ \Gamma_{ \phantom{\, r} \, t \, t }^{ \, r \phantom{\, t} \phantom{\, t} } & = & \frac{a^{2} m r^{2} - 2 \, m^{2} r^{3} + m r^{4} - {\left(a^{4} m - 2 \, a^{2} m^{2} r + a^{2} m r^{2}\right)} \cos\left({\theta}\right)^{2}}{a^{6} \cos\left({\theta}\right)^{6} + 3 \, a^{4} r^{2} \cos\left({\theta}\right)^{4} + 3 \, a^{2} r^{4} \cos\left({\theta}\right)^{2} + r^{6}} \\ \Gamma_{ \phantom{\, r} \, t \, {\phi} }^{ \, r \phantom{\, t} \phantom{\, {\phi}} } & = & -\frac{{\left(a^{3} m r^{2} - 2 \, a m^{2} r^{3} + a m r^{4} - {\left(a^{5} m - 2 \, a^{3} m^{2} r + a^{3} m r^{2}\right)} \cos\left({\theta}\right)^{2}\right)} \sin\left({\theta}\right)^{2}}{a^{6} \cos\left({\theta}\right)^{6} + 3 \, a^{4} r^{2} \cos\left({\theta}\right)^{4} + 3 \, a^{2} r^{4} \cos\left({\theta}\right)^{2} + r^{6}} \\ \Gamma_{ \phantom{\, r} \, r \, r }^{ \, r \phantom{\, r} \phantom{\, r} } & = & \frac{a^{2} r - m r^{2} + {\left(a^{2} m - a^{2} r\right)} \cos\left({\theta}\right)^{2}}{a^{2} r^{2} - 2 \, m r^{3} + r^{4} + {\left(a^{4} - 2 \, a^{2} m r + a^{2} r^{2}\right)} \cos\left({\theta}\right)^{2}} \\ \Gamma_{ \phantom{\, r} \, r \, {\theta} }^{ \, r \phantom{\, r} \phantom{\, {\theta}} } & = & -\frac{a^{2} \cos\left({\theta}\right) \sin\left({\theta}\right)}{a^{2} \cos\left({\theta}\right)^{2} + r^{2}} \\ \Gamma_{ \phantom{\, r} \, {\theta} \, {\theta} }^{ \, r \phantom{\, {\theta}} \phantom{\, {\theta}} } & = & -\frac{a^{2} r - 2 \, m r^{2} + r^{3}}{a^{2} \cos\left({\theta}\right)^{2} + r^{2}} \\ \Gamma_{ \phantom{\, r} \, {\phi} \, {\phi} }^{ \, r \phantom{\, {\phi}} \phantom{\, {\phi}} } & = & \frac{{\left(a^{4} m r^{2} - 2 \, a^{2} m^{2} r^{3} + a^{2} m r^{4} - {\left(a^{6} m - 2 \, a^{4} m^{2} r + a^{4} m r^{2}\right)} \cos\left({\theta}\right)^{2}\right)} \sin\left({\theta}\right)^{4} - {\left(a^{2} r^{5} - 2 \, m r^{6} + r^{7} + {\left(a^{6} r - 2 \, a^{4} m r^{2} + a^{4} r^{3}\right)} \cos\left({\theta}\right)^{4} + 2 \, {\left(a^{4} r^{3} - 2 \, a^{2} m r^{4} + a^{2} r^{5}\right)} \cos\left({\theta}\right)^{2}\right)} \sin\left({\theta}\right)^{2}}{a^{6} \cos\left({\theta}\right)^{6} + 3 \, a^{4} r^{2} \cos\left({\theta}\right)^{4} + 3 \, a^{2} r^{4} \cos\left({\theta}\right)^{2} + r^{6}} \\ \Gamma_{ \phantom{\, {\theta}} \, t \, t }^{ \, {\theta} \phantom{\, t} \phantom{\, t} } & = & -\frac{2 \, a^{2} m r \cos\left({\theta}\right) \sin\left({\theta}\right)}{a^{6} \cos\left({\theta}\right)^{6} + 3 \, a^{4} r^{2} \cos\left({\theta}\right)^{4} + 3 \, a^{2} r^{4} \cos\left({\theta}\right)^{2} + r^{6}} \\ \Gamma_{ \phantom{\, {\theta}} \, t \, {\phi} }^{ \, {\theta} \phantom{\, t} \phantom{\, {\phi}} } & = & \frac{2 \, {\left(a^{3} m r + a m r^{3}\right)} \cos\left({\theta}\right) \sin\left({\theta}\right)}{a^{6} \cos\left({\theta}\right)^{6} + 3 \, a^{4} r^{2} \cos\left({\theta}\right)^{4} + 3 \, a^{2} r^{4} \cos\left({\theta}\right)^{2} + r^{6}} \\ \Gamma_{ \phantom{\, {\theta}} \, r \, r }^{ \, {\theta} \phantom{\, r} \phantom{\, r} } & = & \frac{a^{2} \cos\left({\theta}\right) \sin\left({\theta}\right)}{a^{2} r^{2} - 2 \, m r^{3} + r^{4} + {\left(a^{4} - 2 \, a^{2} m r + a^{2} r^{2}\right)} \cos\left({\theta}\right)^{2}} \\ \Gamma_{ \phantom{\, {\theta}} \, r \, {\theta} }^{ \, {\theta} \phantom{\, r} \phantom{\, {\theta}} } & = & \frac{r}{a^{2} \cos\left({\theta}\right)^{2} + r^{2}} \\ \Gamma_{ \phantom{\, {\theta}} \, {\theta} \, {\theta} }^{ \, {\theta} \phantom{\, {\theta}} \phantom{\, {\theta}} } & = & -\frac{a^{2} \cos\left({\theta}\right) \sin\left({\theta}\right)}{a^{2} \cos\left({\theta}\right)^{2} + r^{2}} \\ \Gamma_{ \phantom{\, {\theta}} \, {\phi} \, {\phi} }^{ \, {\theta} \phantom{\, {\phi}} \phantom{\, {\phi}} } & = & -\frac{{\left({\left(a^{6} - 2 \, a^{4} m r + a^{4} r^{2}\right)} \cos\left({\theta}\right)^{5} + 2 \, {\left(a^{4} r^{2} - 2 \, a^{2} m r^{3} + a^{2} r^{4}\right)} \cos\left({\theta}\right)^{3} + {\left(2 \, a^{4} m r + 4 \, a^{2} m r^{3} + a^{2} r^{4} + r^{6}\right)} \cos\left({\theta}\right)\right)} \sin\left({\theta}\right)}{a^{6} \cos\left({\theta}\right)^{6} + 3 \, a^{4} r^{2} \cos\left({\theta}\right)^{4} + 3 \, a^{2} r^{4} \cos\left({\theta}\right)^{2} + r^{6}} \\ \Gamma_{ \phantom{\, {\phi}} \, t \, r }^{ \, {\phi} \phantom{\, t} \phantom{\, r} } & = & -\frac{a^{3} m \cos\left({\theta}\right)^{2} - a m r^{2}}{a^{2} r^{4} - 2 \, m r^{5} + r^{6} + {\left(a^{6} - 2 \, a^{4} m r + a^{4} r^{2}\right)} \cos\left({\theta}\right)^{4} + 2 \, {\left(a^{4} r^{2} - 2 \, a^{2} m r^{3} + a^{2} r^{4}\right)} \cos\left({\theta}\right)^{2}} \\ \Gamma_{ \phantom{\, {\phi}} \, t \, {\theta} }^{ \, {\phi} \phantom{\, t} \phantom{\, {\theta}} } & = & -\frac{2 \, a m r \cos\left({\theta}\right)}{{\left(a^{4} \cos\left({\theta}\right)^{4} + 2 \, a^{2} r^{2} \cos\left({\theta}\right)^{2} + r^{4}\right)} \sin\left({\theta}\right)} \\ \Gamma_{ \phantom{\, {\phi}} \, r \, {\phi} }^{ \, {\phi} \phantom{\, r} \phantom{\, {\phi}} } & = & -\frac{a^{2} m r^{2} + 2 \, m r^{4} - r^{5} + {\left(a^{4} m - a^{4} r\right)} \cos\left({\theta}\right)^{4} - {\left(a^{4} m - a^{2} m r^{2} + 2 \, a^{2} r^{3}\right)} \cos\left({\theta}\right)^{2}}{a^{2} r^{4} - 2 \, m r^{5} + r^{6} + {\left(a^{6} - 2 \, a^{4} m r + a^{4} r^{2}\right)} \cos\left({\theta}\right)^{4} + 2 \, {\left(a^{4} r^{2} - 2 \, a^{2} m r^{3} + a^{2} r^{4}\right)} \cos\left({\theta}\right)^{2}} \\ \Gamma_{ \phantom{\, {\phi}} \, {\theta} \, {\phi} }^{ \, {\phi} \phantom{\, {\theta}} \phantom{\, {\phi}} } & = & \frac{a^{4} \cos\left({\theta}\right) \sin\left({\theta}\right)^{4} - 2 \, {\left(a^{4} - a^{2} m r + a^{2} r^{2}\right)} \cos\left({\theta}\right) \sin\left({\theta}\right)^{2} + {\left(a^{4} + 2 \, a^{2} r^{2} + r^{4}\right)} \cos\left({\theta}\right)}{{\left(a^{4} \cos\left({\theta}\right)^{4} + 2 \, a^{2} r^{2} \cos\left({\theta}\right)^{2} + r^{4}\right)} \sin\left({\theta}\right)} \end{array}$

## The Einstein equation

Let us check that the Ricci tensor of $g$ vanishes identically, which is equivalent to the Einstein equation in vacuum:

In [11]:
g.ricci().display()

$\mathrm{Ric}\left(g\right) = 0$

On the contrary, the Riemann tensor is not zero:

In [12]:
R = g.riemann()
print(R)

Tensor field Riem(g) of type (1,3) on the 4-dimensional Lorentzian manifold M
In [13]:
R[0,1,2,3]

$-\frac{{\left(a^{7} m - 2 \, a^{5} m^{2} r + a^{5} m r^{2}\right)} \cos\left({\theta}\right) \sin\left({\theta}\right)^{5} + {\left(a^{7} m + 2 \, a^{5} m^{2} r + 6 \, a^{5} m r^{2} - 6 \, a^{3} m^{2} r^{3} + 5 \, a^{3} m r^{4}\right)} \cos\left({\theta}\right) \sin\left({\theta}\right)^{3} - 2 \, {\left(a^{7} m - a^{5} m r^{2} - 5 \, a^{3} m r^{4} - 3 \, a m r^{6}\right)} \cos\left({\theta}\right) \sin\left({\theta}\right)}{a^{2} r^{6} - 2 \, m r^{7} + r^{8} + {\left(a^{8} - 2 \, a^{6} m r + a^{6} r^{2}\right)} \cos\left({\theta}\right)^{6} + 3 \, {\left(a^{6} r^{2} - 2 \, a^{4} m r^{3} + a^{4} r^{4}\right)} \cos\left({\theta}\right)^{4} + 3 \, {\left(a^{4} r^{4} - 2 \, a^{2} m r^{5} + a^{2} r^{6}\right)} \cos\left({\theta}\right)^{2}}$

## The Kretschmann scalar

The Kretschmann scalar is the following square of the Riemann tensor: $K = R_{abcd} R^{abcd}$ We compute first the tensors $R_{abcd}$ and $R^{abcd}$ by respectively lowering and raising the indices of $R$ with the metric $g$:

In [14]:
dR = R.down(g)
print(dR)

Tensor field of type (0,4) on the 4-dimensional Lorentzian manifold M
In [15]:
uR = R.up(g)
print(uR)

Tensor field of type (4,0) on the 4-dimensional Lorentzian manifold M

Then we perform the contraction:

In [16]:
K = dR['_{abcd}']*uR['^{abcd}']
print(K)
K.display()

Scalar field on the 4-dimensional Lorentzian manifold M
$\begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, r, {\theta}, {\phi}\right) & \longmapsto & -\frac{48 \, {\left(a^{6} m^{2} \cos\left({\theta}\right)^{6} - 15 \, a^{4} m^{2} r^{2} \cos\left({\theta}\right)^{4} + 15 \, a^{2} m^{2} r^{4} \cos\left({\theta}\right)^{2} - m^{2} r^{6}\right)}}{a^{12} \cos\left({\theta}\right)^{12} + 6 \, a^{10} r^{2} \cos\left({\theta}\right)^{10} + 15 \, a^{8} r^{4} \cos\left({\theta}\right)^{8} + 20 \, a^{6} r^{6} \cos\left({\theta}\right)^{6} + 15 \, a^{4} r^{8} \cos\left({\theta}\right)^{4} + 6 \, a^{2} r^{10} \cos\left({\theta}\right)^{2} + r^{12}} \end{array}$

A variant of this expression can be obtained by invoking the factor() method on the coordinate function representing the scalar field in the manifold's default chart:

In [17]:
Kr = K.expr().factor()
Kr

$-\frac{48 \, {\left(a^{2} \cos\left({\theta}\right)^{2} + 4 \, a r \cos\left({\theta}\right) + r^{2}\right)} {\left(a^{2} \cos\left({\theta}\right)^{2} - 4 \, a r \cos\left({\theta}\right) + r^{2}\right)} {\left(a \cos\left({\theta}\right) + r\right)} {\left(a \cos\left({\theta}\right) - r\right)} m^{2}}{{\left(a^{2} \cos\left({\theta}\right)^{2} + r^{2}\right)}^{6}}$

The Schwarzschild value of the Kretschmann scalar is recovered for $a=0$

In [18]:
Kr.subs(a=0)

$\frac{48 \, m^{2}}{r^{6}}$

For a more detailed Kerr notebook (Killing vectors, Bianchi identity, etc.) see here.

In [ ]: