Inverse Trigonometric Functions
Inverse trig functions run sine, cosine, and tangent backwards, recovering the angle from a ratio so measurements can become directions again.
Why Does This Exist?
Forward trig answers "this angle gives what ratio?" Real work usually asks the reverse: a sensor reports a slope, a normalized vector hands you its components, a similarity score lands at 0.866, and you need the angle behind it. Inverse trig functions, arcsine, arccosine, and arctangent, are the way back from ratio to angle.
The catch that justifies a whole page: the way back is ambiguous. Infinitely many angles share one sine, so each inverse function returns a single conventional answer, the principal value, and silently discards the rest. Anyone recovering headings, phases, or rotations who ignores that convention gets angles in the wrong quadrant. The forward direction is in sine, cosine, tangent.
The one idea you need first
A function is invertible only where it never repeats a value. Sine repeats every 360 degrees, so it has no true inverse over the whole circle. Each inverse trig function restricts its partner to one non-repeating interval, then inverts that slice: arcsine () inverts sine on , arccosine () inverts cosine on , arctangent () inverts tangent on .
Think of It Like This
A lost-and-found with many identical umbrellas
Imagine a lost-and-found shelf holding fifty identical black umbrellas. You describe yours and the clerk hands you one umbrella: the rule says you get the one nearest the front. That is a principal value. It is a real umbrella matching your description, but it may not be the one you lost.
Inverse trig is that clerk. "Sine one half" matches 30 degrees, 150 degrees, 390 degrees, and infinitely more, and arcsine hands you 30 degrees because the rule says nearest to zero. When the specific umbrella matters, you need extra information: the signs of both components, which is exactly what atan2 asks for.
How It Actually Works
The three inverses undo their partners within the principal ranges:
In plain words: (arcsine) returns the angle nearest zero with the given sine; returns the angle between 0 and 180 with the given cosine; returns the angle between the poles with the given slope. Inputs to arcsine and arccosine must lie in ; anything outside is not an angle problem but a data bug.
The practitioner's version is atan2(y, x), which takes both components instead of their ratio and returns the full-circle angle in . It resolves the quadrant that plain destroys: gives from atan2 but , the wrong half of the plane.
Worked example
Recover the angles behind three familiar ratios:
- , since and 30 sits inside . Note also has sine 0.5 but is outside the range, so it is not returned.
- , since inside .
- , since slope 1 means equal rise and run.
Cross-check the first: by the supplement rule, confirming the ambiguity is real and the principal value is a choice, not a discovery.
Code
Recover angles and watch plain atan lose the quadrant that atan2 keeps.
import numpy as np
print(round(np.degrees(np.arcsin(0.5)), 4)) # -> 30.0print(round(np.degrees(np.arccos(0.5)), 4)) # -> 60.0print(round(np.degrees(np.arctan2(1.0, -1.0)), 4)) # -> 135.0print(round(np.degrees(np.arctan(-1.0)), 4)) # -> -45.0arctan2(1, -1) correctly reports the second-quadrant while arctan of the same ratio reports . Same slope, different point.
Watch Out For
Using atan(y/x) instead of atan2(y, x)
Dividing first collapses and to the same ratio 1, so atan returns for both while the true angles differ by 180 degrees. Headings flip to the opposite direction with no warning.
Default to atan2(y, x) with the y argument first whenever both components exist. Reserve single-argument atan for genuine slopes where no components survive.
Feeding arcsine a value slightly outside [-1, 1]
A cosine similarity of from floating-point rounding is not a valid arcsine input, and the call returns NaN, which then poisons every downstream number. The value is conceptually fine; it is just outside the domain by dust.
Clip inputs with np.clip(x, -1, 1) before calling arcsin or arccos. If NaN appears right after an angle recovery, check the domain before suspecting the model.
The Quick Version
- Arcsine, arccosine, and arctangent recover angles from sine, cosine, and tangent values.
- Each returns one principal value: arcsine in , arccosine in , arctangent between the poles.
- , , .
- Many angles share each ratio, so the true angle needs extra quadrant information.
- Use
atan2(y, x)overatan(y/x)whenever both components exist. - Clip inputs to before arcsine and arccosine to survive float dust.