<s>[INST] Show that the cosine of $\theta$ is $\frac{1 - t^2}{1 + t^2}$. Where am I going wrong? I've recently picked up the book Mathematics and it's History by John Stillwell due to a recent curiosity in the history of math.  
I started doing one of the exercises in the book and got a little stumped (I'll admit, I'm quite rusty at math).

I'm asked to use this figure ...

... to show that $\cos \theta = \dfrac{1 - t^2}{1 + t^2}$.

I labeled the bottom side of the smaller triangle $a$, and the right side of the smaller triangle as $b$, which makes the bottom side of the bigger triangle $1 + a$.
In these terms, $\cos \theta = a$, since the hypotenuse of the smaller triangle is $1$.
I also came up with the following equations:
$$
a^2 + b^2 = 1
$$
$$
(a + 1)^2 + b^2 = t^2
$$
Solving the first equation for $b$ gives:
$$
b = \sqrt{1 - a^2}
$$
Substituting this equation into the second equation above gives:
$$
(a + 1)^2 + (\sqrt{1 - a^2})^2 = t^2
$$
$$
a^2 + 2a + 1 + 1 - a^2 = t^2
$$
$$
2a + 2 = t^2
$$
$$
a = \frac{t^2 - 2}{2}
$$
As you can tell, $\frac{t^2 - 2}{2}$ is not equal to the given $\frac{1 - t^2}{1 + t^2}$.
Where am I going wrong in my logic? Thanks!
 [/INST] You never say what $t$ is. I suppose that it is the slope of the line. Since it is a line passing through $(-1,0)$ and $(\cos\theta,\sin\theta)$, you have $t=\frac{\sin\theta}{1+\cos\theta}$. So,$$t^2=\frac{1-\cos^2\theta}{(1+\cos\theta)^2}$$and therefore\begin{align}\frac{1-t^2}{1+t^2}&=\frac{(1+\cos\theta)^2-1+\cos^2\theta}{(1+\cos\theta)^2+1-\cos^2\theta}\\&=\frac{2\cos^2\theta+2\cos\theta}{2+2\cos\theta}\\&=\cos\theta.\end{align}
</s>