Understanding the Inverse Cosine (cos⁻¹)
The inverse cosine, written cos⁻¹(x) or arccos(x), answers the question "which angle has a cosine of x?" It undoes the cosine function: if cos(θ) = x, then θ = cos⁻¹(x). Because cosine only ever produces values between −1 and 1, the input x must also fall in that range — there is no real angle whose cosine is, say, 1.5.
The formula
For any x with −1 ≤ x ≤ 1, the angle is computed as:
- θ = cos⁻¹(x), returned natively in radians (as with JavaScript's Math.acos), then converted to degrees with θ° = θ_rad × 180/π, or to gradians with θ_grad = θ° × 10/9.
The result is always the principal value — the one angle between 0° and 180° (0 and π radians) whose cosine equals x. Cosine repeats every 360°, so infinitely many angles technically share a cosine value (cos(60°) = cos(−60°) = cos(300°) = 0.5), but cos⁻¹ always reports the single angle in that 0°–180° window.
Reading a few reference points
- x = 1 → θ = 0° (zero angle)
- x = 0.5 → θ = 60°
- x = 0 → θ = 90° (a right angle)
- x = −0.5 → θ = 120°
- x = −1 → θ = 180° (a straight angle)
Right-triangle and vector use
In a right triangle, cos(θ) = adjacent / hypotenuse, so if you know both side lengths, dividing them gives x and cos⁻¹(x) recovers the angle between that side and the hypotenuse. The same idea extends to vectors: the angle between two vectors u and v is θ = cos⁻¹((u·v) / (|u||v|)), a formula used in physics, computer graphics, and cosine-similarity comparisons.
Degrees, radians, and gradians
Radians are the native unit for cos⁻¹ in mathematics and most programming languages. Degrees are more familiar for everyday geometry, and gradians (400 per full turn) turn up in surveying and some European engineering contexts. This calculator converts automatically between all three so you don't have to.