Sine and cosine
Why this matters
Sine and cosine turn an angle into two numbers: how far across and how far up an arm of length 1 reaches at that angle. That makes them the bridge between turning and coordinates. They're how a direction becomes a pair of numbers, how a picture is rotated, and, in the next lesson, how waves are made. Only two facts are needed to start, and both come from a right triangle. By the end you'll compute them in Python, draw a circle from them point by point, and rotate a shape the way an image model rotates its training pictures.
- Read sine and cosine as ratios of a right triangle's sides
- Place the point at angle θ on the unit circle as (cos θ, sin θ), with its signs by quadrant
- Compute sin and cos in Python, and generate points around a circle with a loop
- Turn an angle into a direction of length 1, and rotate a point, as models do
The math: across and up
Purpose. Turn an angle into an across-and-up pair of numbers.
In a right triangle, pick one of the two sharp angles, θ. The side across from it is the opposite, the side next to it (not the long one) is the adjacent, and the long side is the hypotenuse. Then:
In plain words: sine is how much of the long side goes up; cosine is how much goes across.
In a 3-4-5 triangle with θ at the corner by the side of 4, sin θ = 3/5 = 0.6 and cos θ = 4/5 = 0.8.