Conversion between Rectangular & Polar Forms

An ordered pair (a,b) plotted in the Cartesian or polar coordinate systems typically has a different location from when plotted in the other coordinate system (with the same origin or pole). Given the coordinates of a point in one coordinate system, you might ask what its coordinates are in the other coordinate system so that both identify the same point. To answer this question, we assume that in the Cartesian coordinate system, the independent axis is horizontal and the dependent axis is vertical. We also assume that the polar axis coincides with the x-axis, shares the same origin, and both Cartesian axes and the polar axis have the same scales.

Remark (complex numbers convertion): For those familiar with complex numbers, or for users of complex number calculators like our rectangular/polar complex number converter, the conversion here is analogous to converting between rectangular and polar forms of complex numbers. By noting that the complex number a + bi can also be represented by the ordered pair (a,b), the following conversion formulae can also be applied to complex number conversion.

Converting Cartesian (Rectangular) Coordinates to Polar Coordinates

As shown in the following figure, regardless of the location of the point (x,y), we have r =√(x2 + y2) and tan(φ) = y/x by the Pythagorean Theorem.

Because tan-1() always gives an angle between -π/2 and π/2, we have φ = tan-1(y/x) if (x,y) is in the first or fourth quadrant (that is, if x > 0) by the definition of tan-1.

Because we are dividing by x, it must be non-zero. For the case where x = 0, the point is on the y-axis and the polar angle is θ = π/2 and the radial coordinate is r = y.

If (x,y) is in the second or third quadrant (that is, if x < 0), we must add (or subtract) π to tan-1(y/x) to obtain the corresponding polar angle.

Converting Cartesian coordinates to polar coordinates
Fig 1. Cartesian to Polar: r = √(x2+y2), φ = tan-1(y/x)

To summarize:

Cartesian to Polar Coordinates (1)

If x = 0, then
r = y φ = π/2
Otherwise
r = √(x2+y2)
φ = {
tan-1(y/x)      if x > 0 tan-1(y/x)+π if x < 0

Alternatively, when x < 0, instead of adding π/2 to tan-1(y/x), we can multiply r by -1 to get the corresponding radial coordinate.

Cartesian to Polar Coordinates (2)

If x = 0, then
r = y φ = π/2
Otherwise
r = {
  √(x2+y2) if x > 0 -√(x2+y2) if x < 0
φ= tan-1(y/x)

The radial coordinate in the above can be expressed concisely using the signum function, sgn(), as:

Cartesian to Polar Coordinates

If x = 0, then
r = y φ = π/2
Otherwise
r = sgn(x)√(x2+y2) φ = tan-1(y/x)

Note: Any of the above three formulas can be used to convert Cartesian to polar coordinates.

Converting Polar Coordinates to Cartesian (Rectangular) Coordinates

Converting polar coordinates to Cartesian coordinates is straightforward using the definitions of trigonometric functions on a trig circle. Referring to the following figure, it is clear that the point (r,φ) in the polar coordinate system and the point (rcos(φ), rsin(φ)) in the Cartesian coordinate system coincide.

Converting polar coordinates to Cartesian coordinates
Fig 2. Polar to Cartesian: x = rcos(φ), y = rsin(φ)

So we have the following formula for converting polar coordinates to Cartesian coordinates:

Polar to Cartesian Coordinates

x = r*cos(φ) y = r*sin(φ)

Note: The above conversion formula holds even if r is negative. If r < 0, then x = -|r|*cosφ = -(-r)*cosφ = r*cosφ, and similarly, y = -|r|*sinφ = -(-r)*sinφ = r*sinφ.