# How to obtain spherical polar coordinates with respect to a new origin at $(5,0,0)$?

It is straightforward to define define spherical polar coordinates with a shifted origin. Instead of requiring \begin{align*} x_1 & = r \sin \theta \cos \phi, \\ x_2 & = r \sin \theta \sin \phi, \\ x_3 & = r \cos \theta, \end{align*} which are spherical polar coordinates with respect to the usual origin, we can instead require that, say, \begin{align*} x_1 & = 5 +r \sin \theta \cos \phi, \\ x_2 & = r \sin \theta \sin \phi, \\ x_3 & = r \cos \theta, \end{align*} which will results in spherical coordinates with respect to a new origin at $(5,0,0)^\top$. But say we are given a value $(x_1,x_2,x_3)$ in Cartesian coordinate, how do we obtain the spherical polar represenation $(r,\theta,\phi)$ with respect to the new origin? Wikipeda gives the transformation from Cartesian to spherical polar coordinates, but it is with respect to the usual origin $(0,0,0)$.

What do we use to obtain the coordinates with respect to the new origin?

## 1 Answer

Notice that

\begin{align*} x_1 & = 5 +r \sin \theta \cos \phi, \\ x_2 & = r \sin \theta \sin \phi, \\ x_3 & = r \cos \theta, \end{align*}

is equivalent to:

\begin{align*} x_1-5 & = r \sin \theta \cos \phi, \\ x_2 & = r \sin \theta \sin \phi, \\ x_3 & = r \cos \theta, \end{align*}

Define new coordinates \begin{align*} y_1 & = x_1-5, \\ y_2 & = x_2, \\ y_3 & = x_3, \end{align*}

Now $(y_1, y_2, y_3)$ can be transformed to the usual spherical coordinates $(r, \theta, \phi)$ using the formulas from the Wikipedia page: $\DeclareMathOperator{\atan}{atan2}$ \begin{align*} r & = \sqrt{y_1^2+y_2^2+y_3^2}, \\ \theta & = \arccos\frac{y_3}{\sqrt{y_1^2+y_2^2+y_3^2}}, \\ \phi & = \atan(y_2,y_1), \end{align*}

Returning to the coordinates $(x_1, x_2, x_3)$ we obtain:

\begin{align*} r & = \sqrt{(x_1-5)^2+x_2^2+x_3^2}, \\ \theta & = \arccos\frac{x_3}{\sqrt{(x_1-5)^2+x_2^2+x_3^2}}, \\ \phi & = \atan(x_2, x_1-5), \end{align*}

The $\atan$ function is defined as:

$$\atan(y,x) = \begin{cases} 2\arctan\left(\frac{y}{\sqrt{x^2+y^2}+x}\right), & \text{if x>0 or y\ne 0} \\ \pi, & \text{if x<0 and y=0} \\ \text{undefined}, & \text{otherwise} \end{cases}$$