The angle ends at the point of the unit circle. The blue leg is , the amber leg is , and the navy radius is .
These three form a right triangle, so by the Pythagorean theorem . Here: .
Divide that identity by to get . It holds wherever .
Divide it by instead to get . It holds wherever .
The identities hold for every angle, which is why the result does not depend on what you typed.