# How to compute and interpret Schwartzchild black-hole metric line element $ds$ in Cartesian coordinates?

The Schwarzschild metric in Cartesian coordinates is listed on Wikipedia as:

Line element Notes
$$-{\frac {\left(1-{\frac {r_{\mathrm {s} }}{4R}}\right)^{2}}{\left(1+{\frac {r_{\mathrm {s} }}{4R}}\right)^{2}}}\,{dt}^{2}+\left(1+{\frac {r_{\mathrm {s} }}{4R}}\right)^{4}\,\left(dx^{2}+dy^{2}+dz^{2}\right)$$ $$R = \sqrt{ x^2 + y^2 + z^2 }$$ Valid only outside the event horizon: $$R>r_s/4$$

I am new to computing metrics, if anyone more experienced can help please. Using this Cartesian formula above to compute the path value $$[t, x, y, z]$$ while choosing units to be Schwarzschild radius $$R_s = 1$$ gives the following results:

From $$[0, 4, 4, 4]$$ to $$[1, 5, 5, 5]$$, $$ds = 1.61$$

From $$[0, 4, 4, 4]$$ to $$[2, 5, 5, 5]$$, $$ds = 0.07$$

I am unsure what this means, as both computations start and end at the exact same space coordinates, from $$[4,4,4]$$ to $$[5,5,5]$$. The particle is moving radially outward from the Schwarzschild sphere of radius $$R_s = 1$$, centered at the origin $$[0,0,0]$$.

The only difference is that the first test particle takes 1 time unit to travel the same distance, while the second particle takes a longer 2 time unit to travel the same distance.

1. Why do the ds values vary so greatly if the space endpoints are the same?

2. What does it mean to have $$ds=0$$ between two spacetime points?

The code used to compute the results are as follows:

let ds = straight_line_path([0, 4, 4, 4], [1, 5, 5, 5], 1000000);

function straight_line_path (st1, st2, pixel)
{
let dt = (st2[0]-st1[0])/pixel;
let dx = (st2[1]-st1[1])/pixel;
let dy = (st2[2]-st1[2])/pixel;
let dz = (st2[3]-st1[3])/pixel;

let total = 0;

for (let i=0; i<pixel; i++)
{
total += line_schwartzchild (dt, dx, dy, dz, [st1[1]+i*dx, st1[2]+i*dy, st1[3]+i*dz]);
}

}

function line_schwartzchild (dt, dx, dy, dz, [x0,y0,z0])
{
let r = Math.sqrt (x0*x0 + y0*y0 + z0*z0);

let km = 1 - 1/(4*r);
let kp = 1 + 1/(4*r);

let a = km*km/(kp*kp);
let b = kp*kp*kp*kp;

let sum = Math.abs(-a*(dt*dt) + b*(dx*dx + dy*dy + dz*dz));

return Math.sqrt(sum);
}


Am I using the wrong formula, or computing something wrong along the way?

• Hello! I have edited your question using MathJax (LaTeX) math typesetting. For future questions, you can refer to MathJax basic tutorial and quick reference. Thanks! Commented Oct 18, 2021 at 14:00
• @Jonas thank you. I'm sorry about the code portion having to be rewritten, I didn't realize there is a code field option.
– user315366
Commented Oct 18, 2021 at 14:06
• That is not the regular Schwarzschild coordinates, if you transform the most famous form with gₜₜ=-1/gᵣᵣ=1-rₛ/r into cartesian it should look like f.yukterez.net/einstein.equations/files/8.html#transformation that stuff on Wikipedia are some exotic coordinates Commented Nov 7, 2021 at 4:46
• @Yukterez thank you, it's exactly what i was looking for, the concrete computations!
– user315366
Commented Nov 7, 2021 at 5:03

In addition to @Andrea's answer about interpreting timelike, spacelike, and null paths, there is a computational issue with your method as well.

The metric, $$g_{\alpha\beta}$$, is not the same everywhere in spacetime. It is a function of radial distance from the center. In your calculation you evaluate the metric at the starting point ($$\vec{r}_0$$), and then use that value for the whole path.

$$s = \sqrt{\pm g_{\alpha\beta}(\vec{r}_0) \Delta r^\alpha\,\Delta r^\beta}$$ $$\Delta\vec{r} = \vec{r}_1 - \vec{r}_0,$$ where $$\vec{r}$$ is a four-vector with components $$r^\alpha = (t,x,y,z)$$. If the displacement is small, then this approximate calculation should be acceptable. The correct calculation would integrate $$ds$$ over the path.

$$s = \int_{\vec{r}_0}^{\vec{r}_1} ds = \int_{\vec{r}_0}^{\vec{r}_1} ​d\tau \sqrt{\pm g_{\alpha\beta}[\vec{r}(\tau)] \frac{d r^\alpha}{d\tau}\, \frac{d r^\beta}{d\tau}},$$ where $$\tau$$ is an affine parameterization of the path. For timelike paths, proper time is a common choice.

The integral accounts for the fact that $$g$$ takes on a different value at each point along the path.

For a spacelike path, you would use the $$+$$ under the square root and interpret the $$s$$ as the proper length separating the points. For a timelike path, you would use the $$-$$ and $$s$$ is the proper time taken.

• @James: I'm not an expert in the programming language you're using, but it looks to me like you're only calculating $r$ once, corresponding to the coordinates $(x_0,y_0,z_0)$. The point of this answer is that $r$ changes at each step, and so you would need to recalculate your values for r, km, kp, a, and b at each step as well. Commented Oct 18, 2021 at 15:25
• @James - it seems like taking the video literally might result in accumulated computation errors; I think the video should be viewed more like an intuitive explanation of the mathematics involved, with the result becoming accurate in the limit, rather than a good way to implement the computation in software. If I'm not mistaken, the Christoffel symbols account for the change in the tangent plane (and the associated coordinate chart). Commented Oct 18, 2021 at 15:31
• @ Michael yes, sorry about leaving out the step where I subdivide the original length. I have inserted the rest of the code into the post, does this minimize the differential errors due to using discrete lengths?
– user315366
Commented Oct 18, 2021 at 15:35
• @James I don't know enough to provide a satisfactory answer, but yes, I agree with you that you'd use numerical methods, it's just that I don't think that the animation in the video would directly/naively translate to the algorithm you need (although, perhaps I'm wrong; you could mabye devise some way to try it out in a limited scope). The animation he created doesn't need precision, it just needs to look roughly sensible, so it can in principle be animated by hand (it's more like a blackboard drawing); I suspect there are subtleties that he's glossing over, that you can't gloss over in code. Commented Oct 18, 2021 at 16:18
• @James - P.S. Don't separate the @ from the user handle, otherwise the user doesn't get a notification. Once you type in @ and a couple of initial letters, the system should offer auto-complete suggestions. You can then press tab to accept, or type the whole thing out yourself. Names with spaces are written concatenated (auto-complete should help with that too). Commented Oct 18, 2021 at 16:19

A thing that seems to confuse you is that the line element $$ds$$ is not a measure of distance in space. The line element is a measure of distance in spacetime, and it can be positive, negative and also 0. If a curve $$\gamma$$ (a trajectory in spacetime) is such that $$I(\gamma) = \int_\gamma ds < 0$$, then $$\gamma$$ corresponds to a curve that a massive particle can follow, and the value $$\sqrt{-I}$$ is the amount of time elapsed along that line. This is known as a timelike curve If $$I=0$$, $$\gamma$$ is a path that a massless particle can follow aka a null curve. If $$I>0$$, $$\gamma$$ cannot be followed by any particle, $$\gamma$$ is a spacelike curve.

Now, you observe that two curves $$\gamma$$ and $$\gamma'$$, that start and end at the same space coordinates, are such that $$I(\gamma)\neq I(\gamma')$$. This makes total sense. Consider for simplicity flat space in cartesian coordinates, where the line element is: $$ds^2 = -dt^2 +dx^2+dy^2+dz^2,$$ and two straight lines, both starting at $$(0,0,0,0)$$, and one ends at $$(0,1,0,0)$$ and the other ends at $$(T,1,0,0)$$. Both start and end at the same space coordinates, but they end at different time coordinates. Now compute the $$I$$ corresponding to each line. You will get $$1$$ for the first line and $$1-T^2$$ for the second one. This is totally fine, because they describe different trajectories in spacetime, $$I$$ can be different. In particular, when $$T>1$$, $$1-T^2<0,$$ and thus the second line is a line that a massive particle can follow. While when $$T=1$$, $$1-T^2=0$$. This is a line followed by a light beam.

1. The value of $$ds$$ is different for your two lines because they are two different paths in spacetime. In particular, the second line takes more coordinate time to get from one space coordinate to the other, and thus the line element is closer to 0 than the other.
2. A value of $$I=0$$ means you are looking at a null line. A path that could only be followed by a massless particle (potentially bouncing off mirrors).
• My pleasure. I hadn't checked your code before answering, but fortunately others have. For $ds=0$ geodesics, the method you say won't work. At every spacetime point, there is a whole sphere of null directions. Nothing will prevent your method from zig-zagging around, while a geodesic is the "straightest" past. To figure out what straightest means, you will need the Christoffel symbols. Then your method+Christoffels to ensure straight = solving the geodesic equation (which is a ODE system). Commented Oct 20, 2021 at 8:11