mostly physics and code. about me.

# Numerical integration of light paths in a Schwarzschild metric

14 Oct 2017

## Differential equations of orbit

The Schwarzschild metric is one of the most famous solutions to the Einstein field equations, and the line element in this metric (in natural units $c = G = 1$) is given by:

We are interested in the trajectory of a light ray in such a metric. Since the metric is spherically symmetric, any light ray that starts with a certain $\theta$ must stay in the same $\theta$ plane, hence we can arbitrarily set $\theta = \pi/2$ and do away with all the $\theta$ terms.

Light follows a null (lightlike) trajectory given by $ds^2 = 0$. In the absence of external forces, it should also travel along a geodesic. These are governed by the geodesic equations, which can be derived using Euler-Lagrange equations. Due to the symmetry of the metric, applying the Euler-Lagrange equations to the metric gives us two conserved quantities:

where $\dot{}$ refers to derivative with respect to an affine parameter.

Using the null condition, we have

This can be expressed in terms of $\dot{r}$, and differentiating again gives the second-order differential equation for $r$:

This can be easily converted into a first-order differential equation to be solved numerically by setting a variable $p = \dot{r}$. So we have these 3 differential equations to compute numerically:

(This can of course be solved analytically in the weak gravity limit, which gives the light bending equation $\Delta \phi = 4M/R$.)

## Initial conditions

In principle, we need the initial values of $r$, $p$, and $\phi$ to start the numerical simulation. However, if we fix the incoming velocity to be horizontal, then we would only need to specify the initial $x_0$ and $y_0$ coordinates.

The initial conditions then can be given as follows:

Then, the only free parameters to specify $b$ and $x_0$, in addition to mass.

## Graphs

For a mass of $M = 1$ (corresponding to Schwarzschild black hole radius of 2), this is a plot of the trajectories with different impact parameters $b$:

And they do fit quite well with the theoretical deflection angle, for large impact parameters: