SOLVETUTORMATH SOLVER

Instrument MI-01-029 · Mathematics

Arcus Tangent Calculator

Divide y by x and you lose which quadrant the point sits in. Hand this sheet the y and x components separately and atan2 hands back the one correct angle, anywhere around the full circle.

Instrument MI-01-029
Sheet 1 OF 1
Rev A
Verified
Type 05 — Trigonometry SER. 2026-01029

atan2(y, x)

45.00000000 deg

θ = atan2(y, x)

The working Every figure verified twice
  1. angle = atan2(1, 1) = 0.78539816
Worksheet log
  1. No entries yet — change an input to log a scenario.

How this instrument works

Divide two numbers and the sign of the result only ever tells you one thing: positive or negative. Feed the pair (1, 1) into a single ratio and you get 1 — the same ratio produced by the opposite pair (−1, −1), two points sitting on opposite sides of the origin and aimed in opposite directions, indistinguishable once they are forced through one division. Atan2 never divides first. It reads each sign separately, works out which of the four quadrants that point actually occupies, and only then returns the angle — so those two opposite points come back as 45° and −135°, correctly 180° apart rather than accidentally identical.

The name dates to 1960s Fortran, where ATAN2 was added to the math library as a routine separate from ATAN specifically to handle a case a bare arctangent could not: a vertical line, where the denominator is zero and a plain ratio divides by it, but the angle itself is perfectly well defined at 90° or −90°. Formally, atan2 is built from the ordinary arctan in pieces, one per quadrant, with a correction of 0°, +180°, or −180° added depending on the two signs, plus a pair of special cases along the vertical axis where the ratio does not exist at all. C, Java, Python, and every graphics or navigation library since have kept the same two-argument order and the same name.

One consequence surprises almost everyone the first time a point crosses it: sweep (x, y) counter-clockwise across the negative x-axis and atan2 does not glide through 180° and keep climbing — it reads +180° on one side of that axis and −180° on the other, jumping by a full 360° in an instant even though the point itself moved smoothly. That seam, called a branch cut, is the price of squeezing a value that naturally wraps around a circle into a single number line; the only truly undefined input is the origin itself, x = 0 and y = 0, a point with no direction to report at all.

θ=atan2(y,x)\theta = \operatorname{atan2}(y, x)θ=arctan ⁣(yx)+{0,±180}\theta = \arctan\!\left(\frac{y}{x}\right) + \{0^\circ, \pm 180^\circ\}π<θπ-\pi < \theta \le \pi
y — the numerator, the point's vertical coordinate · x — the denominator, the point's horizontal coordinate · θ — the atan2(y, x) field, the angle of point (x, y) measured from the positive horizontal axis, in your chosen unit.
  • Enter the y component — the numerator — in the y (numerator) field; it can be positive, negative, or zero.
  • Enter the x component in the x (denominator) field; zero is allowed here too, unlike in a plain arctan ratio.
  • Read the atan2(y, x) field for the angle of the point (x, y), measured from the positive x-axis.
  • Switch its unit dropdown between deg, rad, and turn to see the same angle in degrees, radians, or fractions of a full circle.
  • Try y = 1, x = −1 against y = −1, x = 1 to see the same ratio of −1 resolve to two different angles, 135° and −45°.

Worked example — locating the point (1, 1) on the circle

Set y (numerator) to 1 and x (denominator) to 1 — a point one unit up and one unit across from the origin, sitting in the first quadrant. The atan2(y, x) field returns 0.7853981633974483 in radians, or exactly 45° once the unit dropdown is set to deg, because the point (1, 1) lies exactly on the diagonal that splits the first quadrant in half.

The pair worth comparing sits diagonally opposite: setting both fields to −1 produces the identical ratio of 1 that (1, 1) produced, yet the two points face opposite directions across the origin. With −1 entered in both, the atan2(y, x) field reports −2.356194490192345 radians, −135° in degrees, a full 180° away from the first result. A calculator that only ever divided one entry by the other would return the same 45° for both pairs; reading each sign on its own is what tells them apart.

Questions

How does atan2(y, x) differ from computing arctan(y ⁄ x) directly?

Arctan(y ⁄ x) only ever sees one number, the ratio, so it cannot tell a point in the first quadrant from its mirror image in the third — both give the same ratio and the same 45°. Atan2 receives y and x as two separate arguments, checks their individual signs, and places the result in the correct one of all four quadrants, covering the full −180° to 180° range instead of arctan's narrower −90° to 90°.

Why does the order matter — is it atan2(y, x) or atan2(x, y)?

It is atan2(y, x), numerator first — the reverse of how a fraction is usually read left to right. Swapping the two arguments does not just flip a sign; it reflects the angle across the 45° line, turning a genuine mistake into an answer that looks plausible but points the wrong way. This sheet's fields are labelled y (numerator) and x (denominator) in that exact order for that reason.

What happens when x is 0?

Plain arctan(y ⁄ x) breaks down here, since dividing by zero is undefined, but the angle itself is perfectly ordinary: straight up or straight down. Atan2 handles x = 0 as a normal case, returning exactly 90° when y is positive and −90° when y is negative, with no division ever attempted. Only x = 0 together with y = 0 has no defined angle, since the origin has no direction to measure.

Why does the angle jump from 180° to −180° instead of continuing past it?

A single number line has to represent a value that naturally wraps around a circle, so one seam is unavoidable, and convention places it along the negative x-axis. A point drifting smoothly across that axis sees atan2 report +180° a hair before crossing and −180° a hair after — a genuine jump, not a rounding artefact, and the reason navigation and graphics code often adds 360° afterward when a steadily increasing bearing is needed instead.

Where does the name atan2 come from?

From Fortran's math library in the 1960s, which added ATAN2(Y, X) as a routine separate from ATAN precisely because the single-argument version could not resolve quadrants or handle x = 0. The two-argument form and its argument order have stayed the same since, carried into C, Java, Python, and effectively every language's standard library.

Where does atan2 actually get used outside a classroom?

It is the standard way to turn a direction vector into a heading: robotics and flight-control code use atan2(y, x) to convert a velocity's two components into one compass-style angle, and graphics code uses it to find the angle between two points on screen. Anywhere a direction is stored as two components but needed as one angle, atan2 is the conversion.

References