[Math] why is $\cos^2(\theta) + \sin^2(\theta)$ always approximately $1$

trigonometry

I'm doing an exercise from a computer programming book and was asked to determine the following:

why is $\cos^2(\theta) + \sin^2(\theta)$ always approximately $1$ for any theta?

Can someone please explain why the result is always approximately $1$?

Best Answer

Because in math, it is exactly $1$. I have no experience in programming but presumably, when you write a program to approximate $\cos^2\theta+\sin^2\theta$, it will always give something close to the exact value. Here's a short proof. Let $\theta$ be an angle in a right angled triangle, and let the lengths of the adjacent side to that angle, the opposite side, and the hypotenuse be $\mathrm{adj.}$, $\mathrm{opp.}$ and $\mathrm{hyp.}$ respectively.

$$\begin{split}\cos^2\theta+\sin^2\theta & = \left(\frac{\mathrm{adj.}}{\mathrm{hyp}}\right)^2 + \left(\frac{\mathrm{opp.}}{\mathrm{hyp}}\right)^2\\ & = \frac{\mathrm{adj.}^2+\mathrm{opp.}^2}{\mathrm{hyp.}^2}\\ & =^* \frac{\mathrm{hyp.}^2}{\mathrm{hyp.}^2}\\ & = 1. \end{split}$$

Note that the starred equality $=^*$ follows because of the Pythagorean Theorem.