Sine, cosine and the unit circle
P84.angles-trigonometry.02 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Angles and radians
Where next?
This module unlocks
P84.angles-trigonometry.02 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Angles and radians
This module unlocks
The goal of this lesson is to meet the two functions that turn an angle into lengths: the sine and the cosine. They start life in right-angled triangles, grow up on a circle of radius 1, and end as the description of anything that repeats: a turning wheel, an orbit, a swing. You need the previous lesson's radians and Pythagoras' theorem (in a right-angled triangle, the square of the longest side is the sum of the squares of the other two).
Take a right-angled triangle and pick one of its two sharp angles; call it θ. The longest side, the one facing the right angle, is the hypotenuse. Of the two shorter sides, one touches θ (the adjacent side) and one faces it (the opposite side). Two ratios of sides depend only on the angle:
the sine of θ, sin θ = opposite ÷ hypotenuse
the cosine of θ, cos θ = adjacent ÷ hypotenuse
Why only on the angle? Enlarge the triangle to twice its size and every side doubles, so each ratio stays the same. Any two right-angled triangles with the same angle θ are enlargements of each other, so they share sin θ and cos θ.
The classic example has sides 3, 4 and 5 (and 3² + 4² = 9 + 16 = 25 = 5²). For
the angle facing the side 3, sin θ = 3/5 = 0.6 and cos θ = 4/5 = 0.8. Python
can undo the sine with math.asin, which gives the angle back, in radians:
import math
theta = math.asin(0.6) # the angle whose sine is 0.6
print(math.degrees(theta)) # 36.86989764584402
A triangle cannot have an angle of 120° beside its right angle, so the triangle definition stops at 90°. The circle carries it further.
Draw the unit circle: the circle of radius 1 around the point (0, 0). Start at the point (1, 0), on the right, and turn anticlockwise through an angle θ. You arrive at a point on the circle, and its two coordinates are, by definition:
(cos θ, sin θ) — the cosine is how far across, the sine is how high.
For angles between 0 and 90° this agrees with the triangle: drop a line from the point straight down to the horizontal axis and you get a right-angled triangle whose hypotenuse is the radius, 1, so the opposite side is sin θ and the adjacent side is cos θ. Past 90° the definition simply keeps going, and the coordinates can be negative: at 120° the point is to the left of centre, so cos 120° = −0.5, while it is still above, so sin 120° ≈ 0.866.
| Angle | Radians | cos θ (across) | sin θ (up) |
|---|---|---|---|
| 0° | 0 | 1 | 0 |
| 30° | π/6 | √3/2 ≈ 0.866 | 1/2 |
| 45° | π/4 | √2/2 ≈ 0.707 | √2/2 ≈ 0.707 |
| 60° | π/3 | 1/2 | √3/2 ≈ 0.866 |
| 90° | π/2 | 0 | 1 |
| 120° | 2π/3 | −1/2 | √3/2 ≈ 0.866 |
| 180° | π | −1 | 0 |
| 270° | 3π/2 | 0 | −1 |
On a circle of radius r instead of 1, everything is r times larger: the point reached after turning θ is (r cos θ, r sin θ).
math.sin and math.cos expect radians. Give them degrees and they answer a
different question without complaint:
import math
print(math.sin(30)) # -0.9880316240928618
print(math.sin(math.radians(30))) # 0.49999999999999994
The first line is the sine of 30 radians, almost five turns. The second is the sine of 30°, one half, up to the last digit a computer's decimals can hold.
The point (cos θ, sin θ) lies on a circle of radius 1, so its distance from the centre is 1. Pythagoras' theorem in the triangle with sides cos θ, sin θ and 1 says
(sin θ)² + (cos θ)² = 1, for every angle θ.
Writers usually shorten (sin θ)², the sine squared, to sin²θ, and (cos θ)² to cos²θ. The equation is the Pythagorean identity, and it is a working tool: if you know the sine you know the cosine up to its sign. For the 3-4-5 triangle, 0.6² + 0.8² = 0.36 + 0.64 = 1. If sin θ = 0.6 and the angle is between 90° and 180°, then cos θ = −0.8.
The triangle argument uses lengths, which are never negative. Past 90° one or both coordinates are negative, but squaring removes the sign: (−0.5)² is 0.25, the same as 0.5². The point (cos θ, sin θ) is still at distance 1 from the centre, and the distance from (0, 0) to a point (x, y) is √(x² + y²) in every quarter of the plane. So the identity holds for every angle, negative ones and angles of several turns included.
Turn a full turn more and you come back to the same point, so
sin(θ + 2π) = sin θ and cos(θ + 2π) = cos θ.
A function that repeats like this is a periodic function, and the smallest step after which it repeats is its period: 2π for sine and cosine.
Now let the turning happen in time. A point goes round a circle of radius r at a steady pace, once every T seconds, starting on the right. After t seconds it has done t/T of a turn, so its angle is θ = 2πt/T and its position is
x = r cos(2πt/T), y = r sin(2πt/T).
Its height goes up and down, its distance across goes left and right, and both repeat every T seconds. A big wheel with radius 20 m that turns once in 120 s carries a cabin from the level of its hub: after 10 s it has turned a twelfth of a turn, 30°, so the cabin is 20 × sin 30° = 10 m above the hub and 20 × cos 30° ≈ 17.32 m to the side.
The same two curves describe the Moon's position on its orbit day by day, and Physics uses them for every motion that swings back and forth, like a pendulum or a mass on a spring.
Loading the exercise...
Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
Off by default. The mentor always gets your file; this only decides whether your own copy stays here. Copies live in this browser only - they do not follow you to another device, and clearing site data removes them.
Two coding rungs in your browser, in a little Python (Beginner Python teaches it). The second follows a point round a circle and reads its height and width as sine and cosine.
Loading exercise…
Loading exercise…
Loading your notes...