Use SOH-CAH-TOA to find unknown sides and angles in right triangles.
Why this matters
Pythagoras finds a side when you know two sides. Trigonometry goes further: it connects angles to sides. That is how surveyors measure a building's height from the ground, how engineers resolve a force into horizontal and vertical parts, how a roof pitch becomes a rafter length, and how games rotate a sprite to face a target.
The core idea
In a right triangle, pick one of the two acute angles and call it θ (theta). Relative to that angle, name the sides:
- Hypotenuse (H): the longest side, opposite the right angle.
- Opposite (O): the side across from θ.
- Adjacent (A): the side next to θ that is not the hypotenuse.
The labels depend on which angle you choose: the opposite side of one acute angle is the adjacent side of the other.
The three ratios are remembered as SOH-CAH-TOA:
| Ratio | Definition |
|---|---|
| Sine | sin θ = Opposite / Hypotenuse |
| Cosine | cos θ = Adjacent / Hypotenuse |
| Tangent | tan θ = Opposite / Adjacent |
For a given angle these ratios are fixed, however big the triangle is. sin 30° is always 0.5.
Finding a side
Step 1: label the sides relative to the known angle. Step 2: choose the ratio that uses the side you know and the side you want. Step 3: rearrange and compute.
Worked example 1: a ramp
A 10 m ramp rises at 30°. How high does it go?
- Known: hypotenuse = 10. Want: opposite (the height).
- O and H: use sine. sin 30° = O / 10.
- O = 10 × sin 30° = 10 × 0.5 = 5 m.
Worked example 2: a building's height
You stand 40 m from a building and the angle up to its roof is 52°.
- Known: adjacent = 40. Want: opposite.
- O and A: use tangent. O = 40 × tan 52° ≈ 40 × 1.280 = 51.2 m (plus your eye height, if you measured from your eyes).
Finding an angle
To go from a ratio back to an angle, use the inverse functions: sin⁻¹ (arcsin), cos⁻¹ (arccos) and tan⁻¹ (arctan).
Worked example 3: roof pitch
A roof rises 4 m over a horizontal run of 6 m. What angle does it make?
- O = 4, A = 6, so tan θ = 4 / 6 ≈ 0.667.
- θ = tan⁻¹(0.667) ≈ 33.7°.
Degrees and radians
Angles can be measured in degrees (a full turn is 360°) or radians (a full turn is 2π). Most programming languages, including Python and JavaScript, use radians in their trig functions. Convert first:
import math
print(math.sin(math.radians(30))) # 0.49999999999999994, i.e. 0.5
print(40 * math.tan(math.radians(52))) # about 51.2
print(math.degrees(math.atan(4 / 6))) # about 33.69
The tiny error in the first line is normal floating-point rounding. Compare with a tolerance, not ==.
math.atan2(y, x) is a safer angle function in code: it handles all four directions and x = 0 without dividing by zero. Games use it to point an object towards a target.
Resolving a vector
A force of 100 N pulls at 30° above horizontal. Its parts are:
- horizontal = 100 × cos 30° ≈ 86.6 N
- vertical = 100 × sin 30° = 50 N
Splitting a quantity into x and y parts this way is the foundation of physics and engineering mechanics.
Common mistakes
- Calculator or code in the wrong angle mode. sin(30) in radians is about −0.988, not 0.5.
- Mislabelling opposite and adjacent. Always label from the angle you are using.
- Using trig ratios on a non-right triangle. SOH-CAH-TOA needs a 90° angle.
- Dividing when you should multiply. If the unknown is on top of the ratio, multiply; if it is on the bottom, divide (A = O / tan θ).
Quick recap
- Label O, A and H relative to the chosen angle.
- SOH-CAH-TOA: sin = O/H, cos = A/H, tan = O/A.
- Inverse functions turn a ratio back into an angle.
- Code uses radians; convert with
math.radiansandmath.degrees.
Try it
In the Do tab, finish a function that finds the opposite side from an angle and the hypotenuse. An angle-finding function is already written as a model.