Cartesian to Spherical Coordinates – Formulas and Examples

Spherical coordinates are written in the form (ρ, θ, φ), where, ρ represents the distance from the origin to the point, θ represents the angle with respect to the x-axis in the xy plane and φ represents the angle formed with respect to the z-axis. Spherical coordinates can be useful when graphing spheres or other three-dimensional figures represented by angles. This coordinate system is particularly useful in calculus since it is generally easier to obtain the derivatives or integrals using this system when we have problems related to spheres or similar figures.

Here, we will learn about the formulas that we can use to transform from Cartesian to spherical coordinates. Then, we will use these formulas to solve some practice problems.

TRIGONOMETRY
diagram of spherical coordinates

Relevant for

Learning to transform from Cartesian to spherical coordinates.

See examples

TRIGONOMETRY
diagram of spherical coordinates

Relevant for

Learning to transform from Cartesian to spherical coordinates.

See examples

How to transform from Cartesian coordinates to spherical coordinates?

We can transform from Cartesian coordinates to spherical coordinates using right triangles, trigonometry, and the Pythagorean theorem.

Cartesian coordinates are written in the form (x, y, z), while spherical coordinates have the form (ρ, θ, φ). In this form, ρ is the distance from the origin to a three-dimensional point, θ is the angle formed in the xy plane with respect to the x-axis, and φ is the angle formed with respect to the z-axis.

We can look at these components in the following diagram.

diagram of spherical coordinates

We can start by finding the length of ρ in terms of x, y, z. For this, we use the Pythagorean theorem in three dimensions. Therefore, we have that ρ squared is equal to the sum of the squares of x, y, z:

{{\rho}^2}={{x}^2}+{{y}^2}+{{z}^2}

\rho=\sqrt{{{x}^2}+{{y}^2}+{{z}^2}}

The angle θ is the same as that found when transforming to cylindrical coordinates. We find this angle using the inverse tangent function. The tangent of an angle is equal to the opposite side divided by the adjacent side.

In the diagram, we can see that the opposite side is equal to the y component and the adjacent side is the x component. Therefore, we have:

\theta={{\tan}^{-1}(\frac{y}{x})

However, we must bear in mind that the angle θ given by the calculator is sometimes incorrect because the range of the inverse tangent function is -\frac{\pi}{2} to \frac{\pi}{2}. This does not cover all four quadrants of the Cartesian plane, so we use the following table to correct this:

QuadrantValue of {{\tan}^{-1}}
IWe use the value of the calculator
IIWe add 180° to the calculator value
IIIWe add 180° to the calculator value
IVWe add 360° to the calculator value

Finally, we have the angle φ. This is the angle formed by the line and the positive z-axis. This angle goes from 0 to π. To find this angle, we can use the cosine function. The cosine is equal to the adjacent side divided by the hypotenuse.

In the diagram below, we see that the adjacent side is equal to the z component and the hypotenuse is equal to ρ. Therefore, we have:

\phi={{\cos}^{-1}}(\frac{z}{\rho})
diagram to find spherical coordinates

Cartesian to spherical coordinates – Examples with answers

The following examples can be used to understand the process of transforming Cartesian coordinates to spherical coordinates. Try to solve the problems yourself before looking at the answer.

EXAMPLE 1

We have the point (2, 3, 4) in Cartesian coordinates. What is its equivalent in spherical coordinates?

We have the values x=2, ~y=3,~z=4. We use the formulas given above to find the values of ρ, θ and φ. To find the value of ρ, we use the Pythagorean theorem in three dimensions:

\rho=\sqrt{{{x}^2}+{{y}^2}+{{z}^2}}

\rho=\sqrt{{{2}^2}+{{3}^2}+{{4}^2}}

\rho=\sqrt{4+9+16}

\rho=\sqrt{29}

\rho=5.39

We find θ, using the inverse tangent function:

\theta={{\tan}^{-1}}(\frac{y}{x})

\theta={{\tan}^{-1}}(\frac{3}{2})

\theta=0.98 rad

The x and y values are positive, so the point is in the first quadrant. Therefore, the angle obtained is correct.

To find the value of φ, we use the inverse cosine function:

\phi={{\cos}^{-1}}(\frac{z}{\rho})

\phi={{\cos}^{-1}}(\frac{4}{5.39})

\phi=0.73 rad

The spherical coordinates of the point are (5.39, 0.98, 0.73). The angles are written in radians.

EXAMPLE 2

The point (4, 2, 5) is in Cartesian coordinates. What is its equivalent in spherical coordinates?

We can recognize the values x = 4, ~ y = 2, ~ z = 5. We are going to find the values of ρ, θ and φ using the formulas seen above together with the given values. We start with the value of ρ:

\rho=\sqrt{{{x}^2}+{{y}^2}+{{z}^2}}

\rho=\sqrt{{{4}^2}+{{2}^2}+{{5}^2}}

\rho=\sqrt{16+4+25}

\rho=\sqrt{45}

\rho=6.71

We use the inverse tangent to find θ:

\theta={{\tan}^{-1}}(\frac{y}{x})

\theta={{\tan}^{-1}}(\frac{2}{5})

\theta=0.38 rad

This value is correct since the point is located in the first quadrant.

We use the inverse cosine to find the value of φ:

\phi={{\cos}^{-1}}(\frac{z}{\rho})

\phi={{\cos}^{-1}}(\frac{5}{6.71})

\phi=0.73 rad

The spherical coordinates of the point are (6.71, 0.38, 0.73). The angles are written in radians.

EXAMPLE 3

If we have the Cartesian coordinates (-4, 4, 6), what is their equivalence in spherical coordinates?

We have the values x=-4, ~y=4,~z=6. We use the transformation formulas along with the given values to find the values of ρ, θ and φ. The value of ρ is found using the Pythagorean theorem in three dimensions:

\rho=\sqrt{{{x}^2}+{{y}^2}+{{z}^2}}

\rho=\sqrt{{{(-4)}^2}+{{4}^2}+{{6}^2}}

\rho=\sqrt{16+16+36}

\rho=\sqrt{68}

\rho=8.25

Now, we find θ, using the inverse tangent function:

\theta={{\tan}^{-1}}(\frac{y}{x})

\theta={{\tan}^{-1}}(\frac{4}{-4})

\theta=-0.78 rad

The value of x is negative and the value of y is positive, so the point is located in the second quadrant. This means that we have to add 180° or π to find the correct angle. The correct angle is \theta=-0.78+\pi=2.36 rad.

To find the value of φ, we use the inverse cosine function:

\phi={{\cos}^{-1}}(\frac{z}{\rho})

\phi={{\cos}^{-1}}(\frac{6}{8.25})

\phi=0.76 rad

The spherical coordinates of the point are (8.25, 2.36, 0.76). The angles are written in radians.

EXAMPLE 4

We have the point (-2, -4, 5) in Cartesian coordinates. What is its equivalent in spherical coordinates?

We can recognize the values x = -2, ~ y = -4, ~ z = 5. Now, we find the values of ρ, θ and φ using the transformation formulas. To find the value of ρ, we use the Pythagorean theorem in three dimensions:

\rho=\sqrt{{{x}^2}+{{y}^2}+{{z}^2}}

\rho=\sqrt{{{(-2)}^2}+{{(-4)}^2}+{{5}^2}}

\rho=\sqrt{4+16+25}

\rho=\sqrt{45}

\rho=6.71

We find θ, using the inverse tangent function:

\theta={{\tan}^{-1}}(\frac{y}{x})

\theta={{\tan}^{-1}}(\frac{-4}{-2})

\theta=1.11 rad

Both the x and y values are negative, so the point is in the third quadrant. This means that we have to add 180° or π to get the correct angle. Therefore, the correct angle is \theta=1.11+\pi=4.25 rad.

To find the value of φ, we use the inverse cosine function:

\phi={{\cos}^{-1}}(\frac{z}{\rho})

\phi={{\cos}^{-1}}(\frac{5}{6.71})

\phi=0.73 rad

The spherical coordinates of the point are (6.71, 1.11, 0.73). The angles are written in radians.


Cartesian to spherical coordinates – practice problems

Solve the following practice problems using the Cartesian to spherical coordinate transformation formulas seen above.

If we have the Cartesian coordinates (4, 2, 2), what is their equivalent in spherical coordinates?

Choose an answer






We have the Cartesian coordinates (-3, 4, 3). What is its equivalent in spherical coordinates?

Choose an answer






What is the spherical coordinate equivalent of the Cartesian coordinates (-3, -1, 6)?

Choose an answer






If we have the Cartesian coordinates (4, -5, 1), what is their equivalent in spherical coordinates?

Choose an answer







See also

Interested in learning more about spherical coordinates? Take a look at these pages:

Learn mathematics with our additional resources in different topics

LEARN MORE