Introduction
- Given a right angled triangle:
- We have labelled:
- The angle as θ.
- The hypotenuse as h, which is the longest side, and is opposite the right angle.
- The adjacent side as a, which is next to the angle.
- The opposite side as o, which is opposite the angle.
- sin, cos, and tan are functions which convert the angle to a ratio of two of the sides:
Example
- Given the triangle:
- We can calculate:
Code (Python)
import math
# python works in radians, not degrees
theta = math.radians(30)
print(math.sin(theta)) # prints 0.5
print(math.cos(theta)) # prints 0.866...
print(math.tan((theta))) # prints 0.577...
Notes
- sin, cos, and tan are sometimes called sine, cosine, and tangent.
- A simple way to remember the equations for sin, cos, and tan is sohcahtoa:
- soh: sin opposite hypotenuse
- cah: cos adjacent hypotenuse
- toa: tan opposite adjacent
tan as a function of sin and cos
- If we re-arrange the equations for the opposite and adjacent:
- Then we can rewrite tan in terms of sin and cos:
- Which simplifies to:
Graphs of sin, cos, and tan
- We can plot sin on a graph, where:
- x is between 0 and 360
- y = sin(x)
- We see that sin(x) is always between -1 and 1
- And for cos:
- We see that cos(x) is just sin(x) shifted left by 90°
- And finally tan:
- We see that tan(90) and tan(270) aren't defined, as cos(90) and cos(270) are 0, which causes a divide by 0 error.