Skip to main content

Converting Between Polar and Rectangular Coordinates Without the Sign Errors

A practical guide to converting between polar and rectangular coordinates with x=r cosθ, y=r sinθ, r=√(x²+y²), and atan2 for correct quadrants.

Published By Li Lei
#math #coordinates #trigonometry #complex-numbers

Converting Between Polar and Rectangular Coordinates Without the Sign Errors

Every point on a plane has two names. One is the rectangular (Cartesian) name: go x to the right, y up, and you are there. The other is the polar name: walk r units away from the origin in the direction θ. Both describe the exact same spot, and a lot of math, physics, and engineering work comes down to switching from one name to the other at the right moment. Spinning, radiating, or rotating things are easier to reason about in polar form; adding offsets and components is easier in rectangular form.

The conversion is short, but it has two traps that bite people for years: choosing the right inverse-tangent function, and keeping track of which quadrant the point sits in. This guide walks through the formulas, a worked example you can check by hand, and the quadrant rules that keep your signs honest.

The Two Formulas You Actually Need

Going from rectangular to polar uses two formulas:

  • r = √(x² + y²) — the radius, the straight-line distance from the origin by the Pythagorean theorem.
  • θ = atan2(y, x) — the angle, measured counterclockwise from the positive x-axis.

Going back from polar to rectangular is even simpler:

  • x = r·cos θ
  • y = r·sin θ

That is the whole toolkit. The radius is never negative, because it is a distance. The angle is where all the subtlety lives, and the reason I keep writing atan2(y, x) instead of atan(y/x) is the single most important habit in this entire topic. The plain arctangent only sees the ratio y/x, so it cannot tell the difference between a point in quadrant I and the point directly opposite it in quadrant III. It also divides by zero when x is 0. The atan2 function takes x and y as separate arguments, reads both signs, and returns the correct angle in all four quadrants.

If you want to run the numbers without wiring up your own code, the Polar / Rectangular Coordinate Converter does both directions, switches between degrees and radians, and draws a small diagram so you can eyeball the quadrant before you trust the answer.

A Worked Example: (3, 4) Becomes (5, 53.13°)

Take the rectangular point (3, 4). It sits three units right and four units up, squarely in quadrant I. Convert it to polar:

  • r = √(3² + 4²) = √(9 + 16) = √25 = 5
  • θ = atan2(4, 3) ≈ 53.13°

So (3, 4) in rectangular form is (5, 53.13°) in polar form. The 3-4-5 right triangle makes the radius come out to a clean 5, which is why this example shows up in every textbook. The angle of 53.13 degrees is the slope of that triangle measured from the horizontal axis.

Now run it back the other way to check yourself:

  • x = 5·cos(53.13°) ≈ 5·0.6 = 3
  • y = 5·sin(53.13°) ≈ 5·0.8 = 4

You land back on (3, 4). That round trip is the sanity check I do every single time I write conversion code: convert forward, convert back, and confirm I arrive at the input. If the numbers do not match, the bug is almost always a degrees-versus-radians mix-up or a missing sign.

Quadrant Handling Is the Whole Game

Here is the part that trips people up. The atan2 function returns angles in the range (−180°, 180°]. That means a point straight down, like (0, −1), comes out as −90°, not 270°. A point in quadrant III, like (−1, −1), comes out as −135°.

Both answers are correct, but they may not be the convention your next step expects. There are two common ranges:

  • [0, 360) — used in navigation, surveying, and compass bearings, where negative angles look strange. Here (−1, −1) reads as 225° and (0, −1) reads as 270°.
  • (−180, 180] — used in physics and signal processing, where a signed phase angle is exactly what the next formula wants.

The two conventions describe the same directions; they just label the lower half of the circle differently. The classic mistake is computing an angle in one convention and pasting it into a formula that expects the other, which shifts every downstream result. Decide which range your problem needs and pin it down before you start. When you plug (−1, −1) into a converter and watch it return 225° while the diagram clearly draws the point in the lower-left, the quadrant problem stops being abstract.

Where This Shows Up: Complex Numbers, Vectors, and Physics

The reason this conversion matters so much is that polar and rectangular coordinates are the same machinery behind several different topics.

Complex numbers. A complex number a + bi is just the point (a, b). Its polar form r∠θ gives the magnitude r and phase θ that electrical-engineering and signals work asks for. Multiplying two complex numbers is painful in rectangular form but trivial in polar form: multiply the magnitudes, add the angles. Adding them is the reverse. So you constantly convert back and forth, and a complex number calculator leans on exactly the r = √(x²+y²) and θ = atan2(y, x) formulas above.

Vectors and forces. A displacement of "5 metres at 53 degrees" is a polar description. To add it to another vector you need its east and north components, which are x = 5·cos(53°) ≈ 3 and y = 5·sin(53°) ≈ 4. Resolving forces in physics is the same operation: break each force into perpendicular components, add the components, then convert the sum back to a magnitude and direction with a vector calculator.

Physics and engineering. Impedances, phasors, projectile launch angles, and rotational motion all hop between the two forms. An impedance given in polar form has to become resistance and reactance (its rectangular parts) before you can add it in series, then convert back. The conversion is the connective tissue between "how far and which way" and "how much across and how much up."

A Note From My Own Debugging

I lost an embarrassing afternoon once to a coordinate transform that worked perfectly in quadrant I and silently produced garbage everywhere else. My code used atan(y/x). Every test point I had picked happened to live in the upper-right quadrant, so the ratio approach looked fine. The moment a real input landed in quadrant III, the angle folded back 180 degrees and the rest of the pipeline drifted. Swapping in atan2(y, x) fixed it in one line. Now I drop a known awkward point, usually (0, −1) or (−1, −1), into a converter first and confirm it reads the way I expect before I trust any code I have written. Seeing the diagram place the point in the right quadrant catches sign bugs faster than reading numbers ever did.

Quick Reference

  • Rectangular to polar: r = √(x² + y²), θ = atan2(y, x).
  • Polar to rectangular: x = r·cos θ, y = r·sin θ.
  • The radius r is always zero or positive. To point the opposite way, add 180° to the angle, do not negate r.
  • Always use atan2, never atan(y/x), so the quadrant survives and x = 0 does not divide by zero.
  • Match your angle units (degrees vs radians) and your angle range ([0, 360) vs (−180, 180]) to what the next step expects.
  • Check your work with a round trip: convert forward, convert back, confirm you return to the input.

Get the formulas right and the rest is bookkeeping. The two traps, the inverse-tangent choice and the quadrant convention, account for nearly every wrong answer, and both are easy to avoid once you have seen them fail.


Made by Toolora · Updated 2026-06-13