Verifying Trigonometric Identities: $2\cos^2x-1 = \frac{1-\tan^2x}{1+\tan^2x}$ Verify that $$ 2\cos^2x-1 = \frac{1-\tan^2x}{1+\tan^2x}$$

Putting $z=e^{ix}$ we have
$$ \cos x = \frac{1}{2} \left( z + \frac{1}{z} \right) =
\frac{1}{2z} (z^2+1)$$
and
$$ \tan x = \frac{1}{i} \frac{z - \frac{1}{z}}{ z + \frac{1}{z} } =
\frac{1}{i} \frac{z^2-1}{z^2+1}.$$
Now $$2\cos^2 x - 1 = \frac{1}{2z^2} (z^2+1)^2 -1 $$
and $$\frac{1-\tan^2 x}{1 + \tan^2 x} =
\frac{1+\left(\frac{z^2-1}{z^2+1}\right)^2}{1-\left(\frac{z^2-1}{z^2+1}\right)^2} =
\frac{(z^2+1)^2+(z^2-1)^2}{(z^2+1)^2-(z^2-1)^2}=
\frac{2z^4 + 2}{4z^2} = \frac{z^4+1}{2z^2} \\
= \frac{z^4+2z^2+1}{2z^2} -1 =  \frac{1}{2z^2} (z^2+1)^2 -1.$$
I decided to post this computation because it is algorithmic. It should be easy to see that verifying trigonometric identities is equivalent to factoring rational polynomials in one variable and that these proofs can be produced automatically by a computer. 
