## Notes

### Pythagorean Theorem

Suppose given a right-angle triangle with side lengths $$a,\, b$$ and hypotenuse length $$c,$$ as in the figure below. Then these side lengths are related by the equation $$a^2 + b^2 = c^2.$$

We presented one proof of this theorem in the video, but there are many others.

### Sine and Cosine

For an angle $$\theta,$$ $$\cos\theta$$ and $$\sin\theta$$ are respectively defined to be the x- and y-coordinates of the point at angle $$\theta$$ (measured counterclockwise from east) on the unit circle. This is illustrated in the following interactive diagram (use your mouse to drag the green dot around):

In general, the point at angle $$\theta$$ on a circle of radius $$r$$ centered at $$\begin{bmatrix}x_0\\y_0\end{bmatrix}$$ has coordinates $$\begin{bmatrix}x_0 + r\cos\theta\\y_0 + r\sin\theta\end{bmatrix}.$$

When $$0\le \theta < 90^\circ,$$ these can be interpreted in terms of ratios of side lengths of triangles:

Making the connection with triangles allows us to calculate $$\cos\theta$$ and $$\sin\theta$$ by exploiting the Pythagorean theorem, at least for $$0\le \theta < 90^\circ;$$ one can treat the general case by combining this with the identities $$\cos(\theta+90^\circ) = -\sin\theta,$$ $$\sin(\theta+90^\circ) = \cos\theta$$ (look at the diagram to convince yourself of these). In particular, the Pythagorean theorem implies that $\cos^2\theta + \sin^2\theta = 1$ for all $$\theta;$$ this equation is also often referred to as the Pythagorean theorem.

Radians are the natural way to measure angles (whereas degrees are a human convention). By definition, one radian is the angle such that the arc length is equal to the radius of the circle. It follows that in general, an arc of radius $$r$$ and angle $$\theta$$ has length $$r\theta$$ when $$\theta$$ is measured in radians.

We define the number $$2\pi$$ to be the number of radians in a circle (so that $$\pi$$ is half the number of radians in a circle); thus a circle of radius $$r$$ has circumference $$2\pi r.$$ We will soon learn a way to calculate these numbers, and find that $$2\pi \approx 6.28$$ (and so $$\pi \approx 3.14$$). In particular, $$1\text{ radian} = \frac{360}{2\pi}\text{ degrees} \approx 57.3^\circ.$$

We won't actually need radians for a while, but this seemed like as good a place as any to bring them in. They are needed in calculus: for example, the formula $$\sin x = x - \frac{x^3}{3!} + \dotsb$$ (which we'll encounter later) is only valid when $$x$$ is measured in radians. Also, the trig functions in programming languages always expect their arguments in radians.

The ancient Greeks made a mistake in defining $$\pi = \frac{\text{circumference}}{\text{diameter}};$$ although diameters are important in real life, in mathematics proper we essentially exclusively discuss circles in terms of their radius. In particular, the more fundamental constant is $$2\pi = \frac{\text{circumference}}{\text{radius}}.$$ I may sometimes use the non-standard notation $$\Twopi \Defeq 2\pi$$ (in this context, the symbol $$\Twopi$$ should be pronounced "two-pi"). However, this is not something to get too hung up on: although $$\Twopi$$ is an important number, numbers are not that important in mathematics.

### Special values of cos and sin

We'll soon learn an algorithm to compute $$\cos$$ and $$\sin$$ of any angle. In the meantime, we can obtain exact values for a few standard angles:

$$\theta$$ (Degrees)$$\theta$$ (Radians)$$\cos\theta$$$$\sin\theta$$
$$0$$$$0$$$$1$$$$0$$
$$30$$$$\Twopi/12$$$$\sqrt3/2$$$$1/2$$
$$45$$$$\Twopi/8$$$$\sqrt2/2$$$$\sqrt2/2$$
$$60$$$$\Twopi/6$$$$1/2$$$$\sqrt3/2$$
$$90$$$$\Twopi/4$$$$0$$$$1$$

$$0^\circ$$ and $$90^\circ$$ are obvious. We worked out the case $$45^\circ$$ in the video, using the Pythagorean theorem. You'll do the cases $$30^\circ$$ and $$60^\circ$$ in the exercises.

## Exercises

1. Compute $$\cos$$ and $$\sin$$ of $$30^\circ$$ and $$60^\circ.$$
2. Define the tangent function by $$\tan\theta \Defeq \dfrac{\sin\theta}{\cos\theta};$$ that is, $$\tan\theta$$ is the slope of the line passing through the origin at angle $$\theta.$$ We define $$\tan90^\circ = \tan270^\circ = \infty;$$ while we will later encounter the symbols $$+\infty$$ and $$-\infty,$$ this is an unsigned or projective infinity.

Compute $$\tan\theta$$ for the standard angles $$\theta=0^\circ,\, 30^\circ,\, 45^\circ,\, 60^\circ,\, 90^\circ.$$

3. Write down $$\cos,$$ $$\sin,$$ and $$\tan$$ of the standard angles in every quadrant of the unit circle.
4. Consider the following diagram: By calculating the length of the green line segment in two different ways, establish the identity $$$\displaystyle\label{silly-formula} 2\sin\left(\frac{\alpha-\beta}2\right) = \pm\sqrt{(\cos\alpha - \cos\beta)^2 + (\sin\alpha - \sin\beta)^2}$$$
5. Once we've established \eqref{silly-formula}, we can derive all the usual trigonometric identities using algebraic manipulations, with no further geometric insight required.
1. Use \eqref{silly-formula} to derive the "half-angle formulas" \begin{align} \cos(\theta/2) &= \pm\sqrt{\frac{1+\cos(\theta)}2} \label{half-cos}\\ \sin(\theta/2) &= \pm\sqrt{\frac{1-\cos(\theta)}2}. \label{half-sin} \end{align}
2. Use \eqref{half-cos} and \eqref{half-sin} to derive the "double-angle formulas" \begin{align*} \cos(2\theta) &= \cos^2(\theta) - \sin^2(\theta)\\ &= 2\cos^2(\theta) - 1\\ &= 1 - 2\sin^2(\theta)\\ \sin(2\theta) &= 2\cos(\theta)\sin(\theta) \end{align*}
3. Derive the "angle-difference" formulas \begin{align} \label{cos-diff} \cos(\alpha-\beta) &= \cos(\alpha)\cos(\beta) + \sin(\alpha)\sin(\beta)\\ \label{sin-diff} \sin(\alpha-\beta) &= \sin(\alpha)\cos(\beta) - \cos(\alpha)\sin(\beta) \end{align} and the "angle-sum" formulas \begin{align} \label{cos-sum} \cos(\alpha+\beta) &= \cos(\alpha)\cos(\beta) - \sin(\alpha)\sin(\beta)\\ \label{sin-sum} \sin(\alpha+\beta) &= \sin(\alpha)\cos(\beta) + \cos(\alpha)\sin(\beta) \end{align} These are sometimes stated in combined form \begin{align*} \cos(\alpha\pm\beta) &= \cos(\alpha)\cos(\beta) \mp \sin(\alpha)\sin(\beta)\\ \sin(\alpha\pm\beta) &= \sin(\alpha)\cos(\beta) \pm \cos(\alpha)\sin(\beta) \end{align*}
This is not the best way to derive these formulas, but it works; the point is mainly that you can get them from each other using pure algebra. We'll see a more enlightening explanation of \eqref{cos-sum} and \eqref{sin-sum} in a future lesson, and then the rest will follow by algebra in a similar way (in the opposite order as you derived them here). In any case, combining \eqref{cos-sum} and \eqref{sin-sum} with \eqref{half-cos} and \eqref{half-sin}—and using the fact that $$\cos$$ and $$\sin$$ are continuous (a notion we will explore in great detail later)—gives a general algorithm for computing $$\cos$$ and $$\sin$$.