4 minutes read

Previously we looked through two different coordinate systems: Cartesian and polar. Maybe, you have already had this question: how are they connected with each other? The need to convert from one coordinate system to another constantly arises in many mathematical problems in order to simplify calculations. For example, look at the equation of a circle with radius 55 in Cartesian coordinates: x2+y2=25x^2 + y^2 = 25. In polar coordinates we can write it down like this: r=5r = 5. It's much better and easier to use, isn't it?

In addition, note that in Cartesian coordinates we already know how to calculate the distance between points and build graphs of functions. There is a natural desire to learn how to do the same in polar coordinates. Let's figure out how it all works.

Conversions between Cartesian and polar coordinates

If given the polar coordinates of a point, how can you find its Cartesian coordinates? What about vice versa? That's what we'll look at in this section. To convert from polar to Cartesian coordinates, we can draw a right triangle:

 Right triangle

Basic trig functions give us the matching equations cosφ=xr\cos\varphi = \frac{x}{r} and sinφ=yr\sin\varphi = \frac{y}{r}, which reduce respectively to

x=rcosφ,y=rsinφ.x=r \cos{\varphi}, \quad y=r \sin{\varphi}.

Now let's go the other direction.

Getting a radius from Cartesian coordinates is easy: r2=x2+y2r^2=x^2+y^2, so r=x2+y2r = \sqrt{x^2 + y^2}. If you only take the positive square root, each point has a single possible radius. But as you remember, each point has infinitely many polar angles, so determining the φ\varphi–coordinate requires making a choice.

First, note from the triangle above that tanφ=yx\tan \varphi = \frac{y}{x}. To solve for φ\varphi, we'll need to "undo" the tan\tan function, whose graph (in Cartesian coordinates) looks like this:

Tangent in the Cartesian system

This is an unfriendly function for several reasons. Firstly, it's not injective: if we drew a horizontal line corresponding to yx=1\frac{y}{x} = 1, that line would intersect the graph at more than one point. Secondly, the intervals are too short: if we trace an arc from φ=π2\varphi = -\frac{\pi}{2} to φ=π2\varphi = \frac{\pi}{2}, it will cover only the right half of a circle. Thirdly, it has vertical asymptotes (dotted lines) where the angles φ=π2,π2,3π2,\varphi = -\frac{\pi}{2}, \frac{\pi}{2}, \frac{3\pi}{2},\dots don't have defined tangents, despite mapping to perfectly good points on the yy–axis. To solve these problems, early programmers developed the atan2\text{atan2} function, which is a bit of a Frankenstein:

{\displaystyle \operatorname {atan2} (y,x)={\begin{cases}\arctan \left({\frac {y}{x}}\right)&{\mbox{if }}x>0\\\arctan \left({\frac {y}{x}}\right)+\pi &{\mbox{if }}x<0{\mbox{ and }}y\geq 0\\\arctan \left({\frac {y}{x}}\right)-\pi &{\mbox{if }}x<0{\mbox{ and }}y<0\\{\frac {\pi }{2}}&{\mbox{if }}x=0{\mbox{ and }}y>0\\-{\frac {\pi }{2}}&{\mbox{if }}x=0{\mbox{ and }}y<0\\{\text{undefined}}&{\mbox{if }}x=0{\mbox{ and }}y=0.\end{cases}}}

Armed with atan2\text{atan2}, we can now send any pair (x,y)(x,y) to an angular coordinate in the interval π<φπ-\pi < \varphi \le \pi. So our conversions are:

(x,y)(x2+y2,  atan2(y,x))and(r,φ)  (rcosφ,  rsinφ).\begin{align*} (x,y) \to& \left(\sqrt{x^2 + y^2}, \; \text{atan2}(y,x)\right) \quad \text{and} \\ (r,\varphi) \to& \; (r\cos\varphi, \; r\sin\varphi). \end{align*}

Distance between two points

In the Cartesian coordinate system, the distance formula is a simple application of the Pythagorean formula. In polar coordinates, we need to bring in an extension called the law of cosines. If a,b,a,b, and cc are the side lengths of any triangle, and the angle γ\gamma is opposite side cc, we have:

c2=a2+b22abcosγc^2 = a^2 + b^2 - 2ab\cos \gammaIn the case that γ\gamma is a right angle, the cosine will be 00 and the equation reduces to the familiar a2+b2=c2a^2 + b^2 = c^2. To see the applicability to polar coordinates, study this figure:

Distance between two points

We can use r1r_1 and r2r_2 as side lengths aa and bb, then calculate γ=φ2φ1\gamma = \varphi_2-\varphi_1, so that the unknown length cc is the distance between points M1M_1 and M2M_2. After taking the square root of both sides we're left with

c=r12+r222r1r2cos(φ2φ1).c=\sqrt{r_1^2+r_2^2-2r_1r_2\cos{(\varphi_2-\varphi_1)}}.

Like most problems involving straight lines, this is easier in Cartesian coordinates than in polar.

Graphing functions in polar coordinates

In Cartesian coordinates, we typically write functions as y=f(x)y = f(x). In polar coordinates, that becomes r=f(φ)r = f(\varphi), meaning that the dependent and independent variables are radius and polar angle, respectively.

As we mentioned, a circle centered on the origin with radius aa is described with the equation r=ar=a. The Cartesian equivalent would be the horizontal line y=ay = a.

In the Cartesian system, this is a horizontal line

No matter what angle you input, the radius will be aa, so the circle includes the points (a,0),(a,π2),(a,π),(a, 0),\, \left(a,\frac{\pi}{2}\right),\, (a,\pi), etc. It's trivial to show that, for any angle φ\varphi, f(φ)=f(φ+2π)f(\varphi) = f(\varphi + 2\pi), so the whole graph can be drawn in a single rotation.

The sine and cosine functions can draw polar roses with beautifully symmetrical petals. For example, the function r=sin(4φ)r=\sin(4\varphi) defines this rose:

Polar rose

Just like the circle, this function wraps around and starts tracing over itself when φ=2π\varphi = 2\pi. Does every function have that property?

In Cartesian coordinates, a line has the equation y=mx+by = mx + b. In polar coordinates, the corresponding equation r=a+bφr=a+b\varphi graphs an Archimedean spiral. Letting a=0a=0 and b=1b = 1, we get the following graph:

Archimedean spiral

Feeling sleepy? Don't worry, we're almost done.

Conclusion

The polar coordinate system is not as prevalent as the Cartesian, but it still finds use in physics, engineering, navigation, and more. When embarking on a project that involves points on a plane, stop and consider: is there a central point around which everything else revolves? Will I need to simulate circular or spiraling trajectories? If so, you may want to use polar coordinates. As we've seen, they do have drawbacks, but in many situations they're the best option.

How did you like the theory?
Report a typo