Trigonometry: sine, cosine and tangent
In short: Trigonometry describes relationships between angles and side lengths in a triangle. Sine, cosine and tangent are the three most important functions for this.
In more detail: In a right-angled triangle with angle α: sin α = opposite / hypotenuse, cos α = adjacent / hypotenuse, tan α = opposite / adjacent.
In Depth
- Mnemonic: “SOH-CAH-TOA”: Sine = Opposite/Hypotenuse, Cosine = Adjacent/Hypotenuse, Tangent = Opposite/Adjacent.
- Unit circle: On the circle of radius 1, cos α and sin α are the x and y coordinates of the point at angle α. This gives values for any angle, also above 90°.
- Important values: sin 30° = 0.5; sin 45° ≈ 0.707; sin 60° ≈ 0.866; sin 90° = 1; cos 0° = 1.
- Pythagorean theorem: a² + b² = c². From it follows sin²α + cos²α = 1.
- Degrees and radians: 360° correspond to 2π radians. Programming languages almost always work in radians.
- Applications: Measuring heights and distances (surveying), navigation, game physics (movement in direction α: x += cos α, y += sin α), oscillations and waves (Fourier transform), computer graphics, rotation.
- Inverse functions: arcsin, arccos, arctan give the angle for a ratio.
atan2(y, x)is the safe variant in programming. - General triangles: Law of sines and law of cosines.
See also: collision detection