Arccos Explained: How the Inverse Cosine Actually Works
Arccos takes a cosine value and returns the angle that produced it — always the one between 0° and 180°. Here is why the function is fenced in on both sides, how it turns three triangle sides into angles via the law of cosines, and the small set of mistakes that cause almost every wrong arccos answer.
What arccos actually does
Cosine answers the question "given this angle, what is the ratio?" Arccos answers the reverse: "given this ratio, what was the angle?" Feed it any number from −1 to 1 and it returns the unique angle between 0° and 180° whose cosine equals that number. arccos(0.5) = 60° because cos(60°) = 0.5; arccos(−1) = 180° because cosine bottoms out at −1 exactly halfway around the circle. The arccos calculator does this instantly for any valid input, reporting the answer in degrees, radians, radians as a multiple of π, and gradians all at once.
You will meet the same function under three names: arccos in mathematics, cos⁻¹ on calculator keypads and in textbooks, and acos in nearly every programming language. They are identical. What this article adds beyond the calculator page is the why: why the input is fenced to [−1, 1], why the answer always lands between 0° and 180° even when the angle you started with did not, where arccos quietly runs the machinery of triangle solving, vector geometry and navigation — and the handful of mistakes that account for almost every wrong arccos answer in homework and code alike.
Why the input has to be between −1 and 1
Cosine is a ratio with a built-in ceiling. In a right triangle it is the adjacent side divided by the hypotenuse, and no side of a right triangle can be longer than the hypotenuse — so the ratio can never exceed 1. On the unit circle the picture is even cleaner: cos θ is simply the x-coordinate of a point on a circle of radius 1, and a point on that circle can never have an x-coordinate beyond ±1. Formally, the NIST Digital Library of Mathematical Functions (§4.23) defines the real arccosine only on the interval [−1, 1] for exactly this reason.
Asking for arccos(2) therefore means asking "which angle has a cosine of 2?" — and no real angle does. A handheld calculator answers with a domain error; JavaScript's Math.acos returns NaN; the arccos calculator tells you directly that the input is out of range rather than inventing a number. This is not a limitation of any particular tool — it is the mathematics itself saying the question has no answer.
Why the answer is always between 0° and 180°
Cosine repeats every 360°, and it is symmetric: cos(−60°) = cos(60°) = cos(300°) = cos(420°) = 0.5. Infinitely many angles share every cosine value. A function, by definition, must return exactly one answer — so mathematicians restrict arccos to the one stretch of angles where cosine hits every value in [−1, 1] exactly once: from 0° to 180° (0 to π radians). Over that interval cosine slides monotonically from 1 down to −1, never repeating, which makes a clean inverse possible. The single answer arccos returns is called the principal value.
This is why a calculator can seem to give the "wrong" angle. If a rotating shaft sat at 300° and you take arccos of its cosine, you get 60° — not 300°. The calculator is not broken; it has no way of knowing which of the infinitely many candidate angles you meant, so it returns the principal one. Recovering the rest is a one-line recipe: every angle with the same cosine as θ = arccos(x) is either θ + 360°k or −θ + 360°k for a whole number k. For 0.5 that generates 60°, 300°, 420°, 660° and so on. Which one is "right" depends entirely on the physical or geometric context — the math alone cannot choose for you.
Worked example: the 5-6-7 triangle
The single most common real use of arccos is the last step of the law of cosines — turning three known triangle sides into an angle. Take a triangle with sides a = 5, b = 6 and c = 7. The law of cosines, rearranged to isolate the angle C opposite the longest side, says:
cos C = (a² + b² − c²) / (2ab)
Plug in the sides: (25 + 36 − 49) / (2 × 5 × 6) = 12/60 = 0.2 exactly. Now the arccos calculator finishes the job: arccos(0.2) = 78.4630°, or 1.369438 radians (0.435906 × π). That is angle C. Repeat for the other two: cos A = (36 + 49 − 25) / (2 × 6 × 7) = 60/84 = 5/7, so A = arccos(0.714286) ≈ 44.4153°; and cos B = (25 + 49 − 36) / (2 × 5 × 7) = 38/70, so B = arccos(0.542857) ≈ 57.1217°. Sanity check: 78.4630 + 44.4153 + 57.1217 = 180.0000. The three angles of a triangle must sum to 180°, and they do.
Two things worth noticing. First, the cosine came out positive for all three angles because this triangle is acute; had one side been long enough to force an obtuse angle, its cosine would have gone negative and arccos would have returned something past 90° — no special handling needed, the sign does the work. Second, notice that arccos(0.2) is nowhere near "0.2 of a right angle" or any other linear guess: the function is genuinely nonlinear, which is why the lookup needs a calculator rather than proportional reasoning. For the full side-and-angle workflow, the triangle calculator runs the law of cosines end to end, and the triangle calculator guide walks through solving every triangle configuration.
Degrees, radians, gradians and multiples of π
Under the hood there is only one answer — an angle — expressed in different units. The natural output of the mathematics is radians: arccos(0.2) = 1.369438 rad. Degrees are that value scaled by 180/π (giving 78.4630°), and gradians — the unit where a right angle is 100, still used in surveying — scale by 200/π (87.1812 gon). Writing radians as a multiple of π is often the most useful form of all in pure math, because the special angles come out as clean fractions: arccos(0.5) is exactly π/3, and arccos(−√2/2) exactly 3π/4. The calculator reports all four forms simultaneously so nothing needs converting by hand.
As for how the number itself is produced: arccos is a transcendental function with no finite algebraic formula, so computers evaluate it with carefully tuned polynomial approximations. In JavaScript the work is done by Math.acos, specified in the ECMAScript standard to follow IEEE 754 floating-point rules — accurate to essentially the last digit a 64-bit float can hold.
Where arccos turns up in the real world
Beyond the classroom, arccos is the standard tool whenever a ratio is easy to measure but an angle is what you need:
- Surveying and construction. Distances between three points are easy to measure directly; the angles between sight lines are not. The law of cosines plus arccos converts the tape-measure numbers into angles, exactly as in the 5-6-7 example above. The same logic powers the oblique triangle area calculator when only sides are known.
- Vectors and computer graphics. The angle between two vectors is arccos of their dot product divided by the product of their lengths. For a = (3, 4) and b = (5, 12): cos θ = (3×5 + 4×12) / (5 × 13) = 63/65 ≈ 0.969231, so θ = arccos(0.969231) ≈ 14.25°. Game engines and robotics code do this millions of times per second to decide what is facing what.
- Navigation. The classic great-circle distance formula computes the central angle between two points on Earth as arccos(sin φ₁ sin φ₂ + cos φ₁ cos φ₂ cos Δλ) — arccos applied to latitudes and longitudes, then multiplied by Earth's radius to get distance.
- Physics and engineering. Work done by a force is W = F·d·cos θ; when the work, force and displacement are known and the angle is wanted, arccos recovers it. Crystal lattice angles, antenna alignment and inclined-plane problems all follow the same pattern: measure the ratio, invert to the angle.
Common mistakes
Nearly every wrong arccos answer traces back to one of five traps:
1. Degree mode versus radian mode. The classic. arccos(0.5) is 60 in degree mode and 1.0472 in radian mode; read the wrong one into a degree-based formula and everything downstream is nonsense. Programming languages are stricter still — Math.acos and its equivalents always return radians, so forgetting the ×180/π conversion is probably the single most common trig bug in code. The arccos calculator sidesteps the trap by showing every unit at once.
2. Reading cos⁻¹ as 1/cos. The superscript −1 on a calculator's cos⁻¹ key means inverse function, not reciprocal. 1/cos(x) is a different function entirely — the secant. cos⁻¹(0.5) is 60°; 1/cos(0.5°) is about 1.00004. Nothing in common but the notation.
3. Expecting arccos(cos θ) to give back θ. It only does when θ is already between 0° and 180°. Outside that window you get the principal value instead: arccos(cos 300°) = 60°. If your application genuinely needs angles beyond the principal range, you must reconstruct them from context using the ±θ + 360°k family described above.
4. Rounding the cosine before inverting. Arccos is brutally sensitive near ±1, because the cosine curve is almost flat there. cos 3° ≈ 0.9986 — round that to 1.00 and the angle collapses to 0°, a three-degree error from a rounding step that looks harmless. By contrast, near 0 the same rounding barely moves the answer. Keep at least four decimal places in the cosine when the angle might be small, and more if it feeds further calculation — this sensitivity is precisely why navigators historically preferred the haversine formula over the arccos form for short distances.
5. Floating-point domain errors in code. A law-of-cosines ratio that is mathematically exactly 1 can come out of floating-point arithmetic as 1.0000000000000002 — and acos of that is NaN, crashing the angle out of an otherwise correct program. The standard defence is to clamp the ratio to [−1, 1] before inverting. If a calculation keeps landing slightly outside the domain, that is usually a hint the underlying triangle is degenerate — the three "sides" lie on a straight line.
arccos and its two siblings
Arcsin and arctan invert sine and tangent the same way arccos inverts cosine, but with a different principal range: both return angles between −90° and +90°, where arccos returns 0° to 180°. The three are tied together by a tidy identity — for any x in [−1, 1], arcsin(x) + arccos(x) = 90° (π/2 radians) — so each of the pair is 90° minus the other. In practice the choice of which to use is made for you by what you measured: adjacent-over-hypotenuse calls for arccos, opposite-over-hypotenuse for arcsin, and opposite-over-adjacent — a slope, a gradient, a rise over a run — for arctan, which is why the slope calculator reaches for arctan rather than arccos when turning a gradient into an angle. A full reference on the principal branches is at Wolfram MathWorld.
When a calculator isn't enough
For everyday geometry — solving triangles, checking a vector angle, converting a ratio from a datasheet — the principal value is exactly what you want and a calculator settles it. The cases that need more care are the ones where the principal range is the wrong range: tracking a continuously rotating object through multiple turns, working with oriented (signed) angles in 2D geometry, or handling inputs that wander outside [−1, 1] because of measurement noise. Those call for context-aware reconstruction of the angle, the two-argument atan2 function, or clamping and error analysis respectively — decisions about the problem, not about arccos itself. And in calculus, arccos has a life of its own: its derivative, −1/√(1 − x²), makes it the antiderivative machinery behind a whole family of integrals, close cousin to the geometry in the Pythagorean theorem guide.
Frequently asked questions
The FAQ on the arccos calculator page covers the definition, the domain and range restrictions, the cos⁻¹ notation, and the exact unit-circle values worth knowing by heart. The questions below tackle what comes up once you start actually using the function — hand calculation, all-solutions recovery, the derivative, and the failure modes in code. For the surrounding geometry, the triangle calculator, Pythagorean theorem calculator and circle calculator cover the shapes these angles live in.
Frequently asked questions
How do I calculate arccos without a calculator?
For the special values, from memory: arccos of 1, √3/2, √2/2, 1/2 and 0 are 0°, 30°, 45°, 60° and 90°, with the negative inputs mirroring to 180° minus those. For anything else there is no clean by-hand method — arccos is transcendental, with no finite algebraic formula — so before electronic calculators people used printed tables and interpolation. Computers evaluate it with polynomial approximations accurate to the last floating-point digit.
Why does my calculator give arccos in radians instead of degrees?
It is in radian mode. The same input produces 1.0472 (radians) or 60 (degrees) for arccos(0.5) depending on the mode setting, and reading one as the other breaks every downstream step. Programming languages do not even offer the choice: acos always returns radians, and you convert to degrees by multiplying by 180/π. Forgetting that conversion is one of the most common trigonometry bugs in code.
How do I find all the angles with a given cosine, not just the arccos answer?
Take θ = arccos(x), the principal value. Every angle with the same cosine is then either θ + 360°k or −θ + 360°k for a whole number k. For x = 0.5, θ = 60°, so the full solution set is 60°, 300°, 420°, 660° and so on, plus the corresponding negative angles. Which solution is the right one depends on the context of the problem — the mathematics alone cannot decide.
What is the derivative of arccos?
d/dx arccos(x) = −1/√(1 − x²), defined for x strictly between −1 and 1. It is exactly the negative of the derivative of arcsin, which follows from the identity arcsin(x) + arccos(x) = π/2 — differentiate both sides and the constant vanishes. The derivative blows up toward infinity as x approaches ±1, which is the calculus view of why arccos is so sensitive to input rounding near the ends of its domain.
Why does arccos of a value close to 1 change so much with tiny input changes?
Because the cosine curve is nearly flat near 0°, so a tiny change in the ratio corresponds to a large change in angle. arccos(0.99) is 8.11°, arccos(0.999) is 2.56°, and arccos(1) is 0° — the third decimal place of the input is deciding whole degrees of output. Practical rule: keep at least four decimal places in a cosine before inverting when the angle might be small. Near x = 0 the function is far more forgiving.
Why does acos return NaN in my code?
The input is outside [−1, 1], usually by a hair. Floating-point arithmetic can turn a ratio that is mathematically exactly 1 into 1.0000000000000002, and acos of that is NaN by specification. The standard fix is to clamp the value to [−1, 1] before calling acos. If inputs keep landing meaningfully outside the domain, the underlying geometry is usually degenerate — for the law of cosines, that means the three "sides" cannot form a triangle.
Does arccos take an angle as its input?
No — that is the reversal that trips people up. Cosine takes an angle and returns a ratio; arccos takes the ratio (a bare number from −1 to 1) and returns the angle. If you feed arccos something you think of as an angle, you are asking which other angle has that cosine value, which is occasionally intended but usually a sign the problem has been set up backwards.
Informational only. Not personalised financial, legal, or tax advice.