Arctan Explained: The Inverse Tangent and the Quadrant It Forgets
Arctan turns a slope back into an angle — but divide two coordinates into one ratio first and the direction information is gone before the function ever runs, which is how headings end up 180° wrong. Here is how the quadrant problem works, when to use atan2 instead, how pitches and percent grades convert to degrees, and how a calculator computes arctan at all.
What arctan actually does
Tangent takes an angle and returns a slope — opposite over adjacent in a right triangle, rise over run on a gradient. Arctan runs that in reverse: give it the slope, and it returns the angle. arctan(1) = 45° because a line that rises exactly as fast as it runs sits at 45°; arctan(0.5) = 26.57° because that is the angle of a 1-in-2 gradient. The arctan calculator accepts any real number — unlike its siblings there is no ±1 fence — and reports the angle in degrees, radians, radians as a multiple of π, and gradians at once.
You will meet the same function as arctan in mathematics, tan⁻¹ on calculator keypads, and atan in code — all identical. The calculator page already covers the definition, why the domain is unlimited, the exact unit-circle values and the asymptote at ±90°. This guide covers what bites in practice: the direction information arctan silently throws away when you divide two coordinates into one ratio, how to get it back with atan2, how pitches and percent grades convert to degrees, and how a machine with no protractor computes the thing at all.
The catch: a ratio has no memory of its quadrant
Arctan's principal range is the open interval from −90° to 90° (−π/2 to π/2 radians), where the NIST Digital Library of Mathematical Functions (§4.23) defines the principal value: the one stretch where tangent sweeps through every real number exactly once. That much parallels arcsin and arccos. The trap peculiar to arctan comes one step earlier, in the division that produced its input.
Suppose you want the direction from the origin to a point. Divide y by x and the signs partially cancel: the point (−4, 3) gives 3/(−4) = −0.75, and the point (4, −3) gives (−3)/4 = −0.75 as well. Two opposite directions, one identical ratio — so no inverse function, however clever, can tell them apart afterwards. The information was destroyed by the division, not lost by arctan. This is a different failure mode from the hidden-second-answer problem of the law of sines, which the arcsin guide covers: there the function's range hides a valid alternative; here the input itself is ambiguous before the function ever runs.
Worked example: from coordinates to a true direction
Take the point (−4, 3) — four units left, three up, clearly in the second quadrant, at a true direction of 143.13° from the positive x-axis. Naively:
arctan(3 / −4) = arctan(−0.75) = −36.87°
Wrong quadrant entirely — that answer points down and to the right. The repair is mechanical once you know it. Check the sign of x: if x is positive, the arctan answer stands. If x is negative, add 180° (or subtract 180°, whichever lands in your preferred range). Here: −36.87° + 180° = 143.13°, correct. You can confirm the raw inversion with the arctan calculator — the quadrant correction is the step you add on top.
Programming languages bundle the correction into a separate two-argument function: atan2(y, x) takes the coordinates before division, keeps both signs, and returns the full direction in (−180°, 180°]: atan2(3, −4) = 143.13° directly, and atan2(−3, −4) = −143.13° for the mirror point. It also handles x = 0 gracefully, where y/x would divide by zero. The rule of thumb: if you have two coordinates, use atan2 and never divide; reach for plain arctan only when the ratio itself is the given — a gradient, a slope from the slope calculator, a tangent value from an equation.
The same repair drives compass work. A target 5 km east and 8 km north of you sits at a bearing of atan2(5, 8) = 32.01° east of north — note the arguments: bearings measure from north, so east displacement plays the "y" role. Get the convention wrong and the error is not subtle; it is the complement of the right answer.
Slopes, pitches and grades: arctan's home turf
Whenever rise is measured against horizontal distance, the ratio is a tangent and arctan converts it to an angle. (If the denominator is the sloped distance — a ladder length, a path — the ratio is a sine instead; the arcsin guide has the full denominator test.) Three trades, three notations, one function:
- Percent grades. A road grade is 100 × rise / run, so degrees = arctan(grade / 100). A 10% grade is arctan(0.10) = 5.71°; a 30% grade — about the steepest a public road gets — is 16.70°. The scale is not linear: 100% is 45°, not vertical, and 200% is only 63.43°. Doubling the percentage never doubles the angle for steep slopes, because arctan flattens as its input grows.
- Roof pitch. Carpenters quote rise per 12 units of run: a 6/12 pitch is arctan(6/12) = arctan(0.5) = 26.57°, and a 12/12 pitch is exactly 45°. Rafter lengths then come from the Pythagorean theorem calculator once the angle fixes the triangle.
- Right-triangle solving. Given the two legs of a right triangle, arctan produces the angles without ever touching the hypotenuse: legs 3 and 4 give arctan(3/4) = 36.87° and its complement 53.13°. The triangle calculator generalises this to any triangle, and the slope guide covers the line-geometry version.
How a machine computes arctan
There is no algebraic formula that turns a ratio into its angle in finitely many steps — arctan is transcendental. What makes it computable is its beautifully simple derivative, 1/(1 + x²), which integrates into the series arctan(x) = x − x³/3 + x⁵/5 − x⁷/7 + … For small inputs this converges fast, and it explains a handy field approximation: for |x| below about 0.1, arctan(x) ≈ x radians — arctan(0.01) is 0.0099997 rad, off by three parts in a million.
At x = 1 the same series becomes the famous but uselessly slow Leibniz formula for π: 4 × (1 − 1/3 + 1/5 − …) creeps to 3.1396 after five hundred terms. The historical fix is Machin's formula (1706): π/4 = 4·arctan(1/5) − arctan(1/239). Both arguments are small, both series converge rapidly, and Machin hand-computed π to 100 digits with it — arctan identities of this family carried every π record for the next two centuries. Modern libraries use tuned polynomial approximations and pocket calculators use CORDIC shift-and-add rotations, but the principle stands: your arctan result comes from a series, not a stored table of every possible angle.
Flat where arcsin is steep
The two inverse functions fail in opposite directions. Arcsin is dangerously steep near ±1, where a fourth-decimal change in the input can move the angle by degrees. Arctan is steepest at zero — where its derivative is exactly 1 and rounding is harmless — and gets flatter forever after: arctan(10) = 84.29°, arctan(20) = 87.14°, arctan(100) = 89.43°. Past roughly x = 20, the first significant figure of the input barely moves the answer.
Flatness cuts both ways. Measuring a near-vertical angle by measuring its tangent is hopeless — the tangent explodes (tan 89° ≈ 57.3, tan 89.9° ≈ 573), so tiny angle differences demand enormous ratio precision. But inverted, the same fact is forgiving: a crude estimate of a large ratio still lands within a degree or two of 90°. Precision matters near zero slope, where arctan transmits input error one-for-one, and stops mattering for steep ones.
Common mistakes
1. Dividing coordinates when you have both of them. The quadrant problem above. y/x throws away the signs' meaning before arctan ever runs; use atan2 (or the x-sign correction) whenever two coordinates exist. Reserve one-argument arctan for genuine ratios.
2. Mixing up the atan2 argument order. Most languages — JavaScript, Python, C, Java — take atan2(y, x), y first. Excel's ATAN2 takes (x, y), x first. Port a formula between the two without swapping and every direction off the axes comes out wrong — this one mistake has broken more heading calculations than any property of arctan itself.
3. Using arctan on rise-over-sloped-distance. A gradient measured along the slope (odometer distance, ladder length) is a sine ratio, not a tangent. For shallow slopes the error hides — arctan and arcsin of 1/8 differ by only 0.05° — then grows brutally as the slope steepens. Identify the denominator first; the arcsin guide walks through the test.
4. Degree mode versus radian mode. arctan(1) is 45 in degree mode and 0.7854 in radian mode, and code never asks — Math.atan always returns radians. Multiply by 180/π, or let the calculator print every unit at once.
5. Expecting 100% to mean vertical. Percent grade is a tangent scaled by 100, so 100% is a 45° slope and no finite percentage is vertical. Treating grade as "percent of 90°" reads a 30% road as 27° when it is actually 16.7° — the error is worst exactly in the range where real roads and ramps live.
When a calculator isn't enough
One ratio, one principal-range angle: the lookup is the whole job, and the identity arctan(x) + arctan(1/x) = 90° (for positive x) even lets you cross-check by inverting the reciprocal. The structural cases need more. Full directions need atan2 and a range convention decided up front — (−180°, 180°] or [0°, 360°). Continuously rotating systems need angle unwrapping, since anything built on arctan jumps by 180° when a tracked line crosses vertical. And in calculus arctan is less a geometry tool than a workhorse: its derivative 1/(1 + x²) makes it the antiderivative behind every integral with a 1 + x² denominator, the closing move of many a partial-fractions problem. The principal-branch conventions are catalogued at Wolfram MathWorld.
Frequently asked questions
The FAQ on the arctan calculator page covers the definition, why any real number is a valid input, the asymptote at ±90°, slope-to-angle basics and the exact values worth memorising. The questions below cover what comes up in use — recovering full directions, the Excel argument-order trap, pitch conversion and computing arctan by hand. For the rest of the inverse-trig family, see the arcsin calculator, arccos calculator and the arccos guide.
Frequently asked questions
Is arctan(tan θ) always equal to θ?
Only when θ is already strictly between −90° and 90°. Outside that window arctan returns the equivalent angle inside its principal range: because tangent repeats every 180°, arctan(tan 120°) = −60°, not 120°. To recover an angle beyond the principal range you must add back the right multiple of 180° from context — or avoid the round trip entirely by carrying coordinates and using atan2.
How do I get a full 0–360° direction from arctan?
Do not divide the coordinates — call atan2(y, x), which keeps both signs and returns an angle in (−180°, 180°]; add 360° to negative results if you want 0–360°. For compass bearings, which measure clockwise from north, swap the roles: bearing = atan2(east displacement, north displacement). A target 5 km east and 8 km north sits at atan2(5, 8) = 32.01° east of north.
Why does Excel’s ATAN2 give different answers from my code?
The argument order is reversed. JavaScript, Python, C and Java all define atan2(y, x) with y first; Excel’s ATAN2(x_num, y_num) takes x first. The two agree along the 45° diagonal and silently disagree everywhere else, so a formula ported between a spreadsheet and code without swapping the arguments produces wrong directions that can survive casual testing.
What is the derivative of arctan?
d/dx arctan(x) = 1/(1 + x²), defined for every real x. It equals 1 at zero — arctan transmits small inputs almost unchanged, which is why arctan(x) ≈ x radians for small x — and decays toward zero as x grows, which is why the curve flattens toward its ±90° asymptotes. Integrating the derivative’s series term by term gives arctan(x) = x − x³/3 + x⁵/5 − …, the basis of both the Leibniz formula for π and Machin’s fast variant.
How do I convert a roof pitch like 6/12 to degrees?
Divide the rise by 12 and take arctan: a 6/12 pitch is arctan(6/12) = arctan(0.5) = 26.57°. A 4/12 pitch is 18.43°, a 9/12 pitch is 36.87°, and a 12/12 pitch — rise equal to run — is exactly 45°. The same recipe converts percent grades, with 100 as the denominator instead of 12: degrees = arctan(grade/100).
How do I calculate arctan without a calculator?
For slopes below about 0.1, arctan(x) ≈ x radians (multiply by 180/π ≈ 57.3 for degrees) — arctan(0.05) ≈ 2.86° with error only in the third decimal. The special values are worth memorising: arctan of 1/√3, 1 and √3 gives 30°, 45° and 60°, with negative inputs flipping the sign. Beyond those, the series x − x³/3 + x⁵/5 − … converges for |x| ≤ 1, and for large x use arctan(x) = 90° − arctan(1/x) to bring the argument back into the fast-converging range.
Does arctan(x) + arctan(1/x) always equal 90°?
For positive x, yes — the two angles are the complementary base angles of a right triangle with legs x and 1, so arctan(4) + arctan(1/4) = 90° exactly. For negative x the identity flips sign: arctan(−4) + arctan(−1/4) = −90°. It never holds with mixed signs, and it is undefined at x = 0. The positive case doubles as a quick cross-check on any arctan result: invert the reciprocal and the two answers should sum to 90°.
Informational only. Not personalised financial, legal, or tax advice.