# How does one covert from Cartesian coordinates to Boyer-Lindquist coordinates?

I am new to physics stackexchange, but I have a question which I seem to have not been able to find an answer to.

I already know that the transformations from Boyer-Lindquist coordinates to Cartesian coordinates are:

$$x=\sqrt{r^2 + a^2}\sin\theta \cos\phi\$$

$$y=\sqrt{r^2 + a^2}\sin\theta \sin\phi$$

$$z=r\cos\theta$$

However, whenever I have seen this transformation stated, I have never seen the inverse. I believe that when $$a=0$$, the transformations reduce from oblate spheroidal coordinates back to spherical coordinates, where:

$$x=r\sin\theta \cos\phi$$

$$y=r\sin\theta \sin\phi$$

$$z=r\cos\theta$$

and,

$$r=\sqrt{x^2 + y^2 + z^2}$$

$$\theta=\arccos(\frac{z}{r})$$

$$\phi=\arctan(\frac{y}{x})$$ (considering quadrants)

So when $$a\neq0$$, how do we define $$(r,\theta,\phi)$$ from $$(x,y,z)$$ (as well as if $$r$$ the coordinate is the same as $$r$$ in the line element/metric)? I think I have understood the rest about the Kerr(-Newman) metric but the definition of Boyer-Lindquist coordinates from Cartesian coordinates is what puzzles me and I have not yet seen an answer. I am doing this in order to simulate test particles in a Kerr-Newman spacetime where $$G, M, Q, c, K$$ may not be $$1$$ using the first order equations of motion from Wikipedia. This may probably only be used in order to easily define initial conditions for the system before intergrating velocities to find the test particles' positions but, I would still like an answer just in case it becomes more important in the future.

Any help, resources or articles would be greatly appreciated as well any fundamental concepts I may not seem to have grasped yet (I won't mind if I have actually been doing everything incorrectly). Thank you very much for reading!

P.S. when defining this term is expressed: $$\frac{x^2 + y^2}{r^2 + a^2} + \frac{z^2}{r^2}=1$$, I found the relation between $$r$$ and $$x,y,z,a$$ to be:

$$r=\frac{\sqrt{\sqrt{z^4 + 2y^2z^2 + 2x^2z^2 + 2a^2z^2 + y^4 + 2x^2y^2 - 2a^2y^2 + x^4 - 2a^2x^2 + a^4} + x^2 + y^2 + z^2 - a^2}}{\sqrt{2}}$$ If this is correct, then that means that I have just incorrectly implemented these and I will try again, or $$\theta$$ and $$\phi$$ aren't the same as they are in spherical coordinates.

• physics.stackexchange.com/questions/568767/… Commented Dec 4, 2022 at 20:14
• You have three equations for three unknowns. Have you tried to solve them? It’s doable. But it’s just math, not physics. Commented Dec 4, 2022 at 21:42
• @Ghoster I have tried but the results are not what I expected. Thank you very much though for the insight! Commented Dec 4, 2022 at 22:20
• the results are not what I expected What did you expect? And, if your results are correct, why does it matter if they aren’t what you expected? If you’re not sure whether you did the algebra and trig correctly, you can check the results numerically. Commented Dec 4, 2022 at 23:39
• @Ghoster I am incredibly sorry for not elaborating further. I hope this does not stray too far into computer science, but I had used two functions: one to convert from oblate spheroidal to cartesian coordinates using the equations at the top, and one to convert from cartesian coordinates to oblate spheroidal coordinates. As a simple test that the functions were indeed correct, I converted their positions to and from oblate spheroidal, but contrary to what I expected, objects only in the xy plane would move. I know the conversion to cartesian is correct, but not the other. That is what I meant. Commented Dec 5, 2022 at 7:06

I have solved my own question. It appears that I incorrectly implemented the formula for $$r$$ with a $$+a^2$$ term instead of $$-a^2$$. I also forgot to make the necessary substitutions for $$r$$ everywhere, including the formula for $$\theta$$. In case anyone cares, the formulae are:
$$r=\frac{\sqrt{\sqrt{z^4 + 2y^2z^2 + 2x^2z^2 + 2a^2z^2 + y^4 + 2x^2y^2 - 2a^2y^2 + x^4 - 2a^2x^2 + a^4} + x^2 + y^2 + z^2 - a^2}}{\sqrt{2}}$$
$$\theta=\arccos(\frac{z}{r})$$
$$\DeclareMathOperator{\atantwo}{atan2} \phi=\atantwo(y,x)$$