Trigonometric Identities
Identities are the short list of trig equations that are always true, so you can swap hard expressions for easy ones instead of recomputing.
Why Does This Exist?
Trig expressions pile up fast: a rotation composed with another rotation, a wave squared inside a power calculation, a phase shifted by an offset. Multiplying everything out each time is slow and error-prone. Identities are pre-proved shortcuts, equations true for every angle, that collapse these tangles into one line.
In ML they surface wherever waves and rotations are manipulated: simplifying Fourier terms, deriving filter responses, normalizing phasors, and checking that a rotation matrix truly preserves length. This page teaches the three identities that do almost all the work, each with its proof sketch. The functions themselves live in sine, cosine, tangent; angle measurement is in angles, radians and degrees.
The one idea you need first
An identity is an equation with a variable that holds for every value of that variable, unlike a conditional equation such as that holds only for . Identities rewrite expressions; equations solve for unknowns. Everything below is a rewrite rule, valid at any angle.
Think of It Like This
A phrasebook, not a dictionary
A dictionary tells you what each word means; a phrasebook tells you that two whole sentences say the same thing, so you can use whichever is shorter. Trig functions are the vocabulary, and identities are the phrasebook: "sine squared plus cosine squared" and "one" are two ways of saying the same thing.
You would never re-derive the translation mid-conversation. You memorize the dozen phrases that come up daily and look up the rest. The three below are the greetings and farewells of trig: used constantly, worth knowing cold.
How It Actually Works
The three workhorses, with and as angles:
In plain words: the squared legs of the unit-circle triangle always rebuild the radius 1 (Pythagoras with hypotenuse 1); tangent is sine divided by cosine by definition of slope; and the double-angle form reads the cosine of twice an angle off the single-angle values. means , the square of the value, not the sine of a square.
Why the first is true: the unit-circle point is at distance 1 from the origin, so Pythagoras gives directly. The double-angle forms ( and the cosine version above) come from the angle-addition rules, which state and in terms of the parts; setting doubles the angle.
Worked example
Verify all three at , where and :
- Pythagoras: exactly.
- Tangent: , matching .
- Double angle: should equal . And indeed .
Three identities, one angle, zero disagreement. Note how the double-angle result lands in the second quadrant with the correct negative sign for free.
Watch Out For
Squaring the angle instead of the value
is , but hurried reading produces , the sine of the squared angle. At the right reading gives while the wrong one gives . Totally different, no error raised.
Keep the square outside the function name visually: write in your own notes until the convention is automatic, and distrust any identity application whose result looks like a raw angle.
Dividing by a cosine that is zero
The tangent identity and any rewrite that divides by silently assumes . At the "identity" divides by zero, and chained simplifications built on it produce infinities dressed as algebra.
Before dividing, check the angle is not an odd multiple of 90 degrees. In code, prefer formulations that keep sine and cosine paired over ones that isolate a tangent.
The Quick Version
- always: Pythagoras on the unit circle.
- : tangent is the slope by definition.
- and handle doubled angles.
- At 60 degrees: , ratio , double-angle cosine .
- squares the value, never the angle.
- Never divide by cosine without checking it is nonzero first.