How to prove that $\tan \left( \frac{\pi}{2} - \theta \right) = \cot \theta$ I am asked to simplify the following expression:
$$\tan \left( \frac{\pi}{2} - \theta \right)$$
The book gives me the answer $\cot \theta$ but, when I try to derive that formula using 
$$\tan \left( A \pm B \right) = \frac{\tan A \pm \tan B}{1 \mp \tan A \cdot \tan B}$$
I get $\tan \frac{\pi}{2}$ as one of the terms (which is undefined). 
$$\tan \left( A \pm B \right) = \frac{\tan A \pm \tan B}{1 \mp \tan A \cdot \tan B} = \frac{\tan \frac{\pi}{2} - \tan \theta}{1 + 0 \cdot \tan \theta}$$
How do I proceed?
Thank you.
 A: The formula for $\tan(A\pm B)$ is obtained by dividing the formula for $\sin(A\pm B)$ by the one for $\cos(A\pm B)$, cancelling a factor of $\cos A\cos B$ from each to obtain the usual expression. As this is an illegal division by $0$ if $A=\frac{\pi}{2}$, it's easiest just to go back to the tangent's definition, viz.$$\tan\left(\frac{\pi}{2}-\theta\right)=\frac{\sin\left(\frac{\pi}{2}-\theta\right)}{\cos\left(\frac{\pi}{2}-\theta\right)}=\frac{\cos\theta}{\sin\theta}=\cot\theta.$$
A: There are several ways one can play with this type of problems.
Here is one:
$\tan\left(\frac{\pi}{2}-\theta \right) =\frac{\sin\left(\frac{\pi}{2}-\theta \right)  }{ \cos\left(\frac{\pi}{2}-\theta \right)  }$
But 
$\sin\left(\frac{\pi}{2}-\theta \right)=\sin\left(\frac{\pi}{2}\right)\cos\left(\theta \right)-\cos\left(\frac{\pi}{2}\right)\sin\left(\theta \right) =1\cos(\theta)-0\sin(\theta)=\cos(\theta)$
and
$\cos\left(\frac{\pi}{2}-\theta \right)=\cos\left(\frac{\pi}{2}\right)\cos\left(\theta \right)+\sin\left(\frac{\pi}{2}\right)\sin\left(\theta \right) =0\sin(\theta)+1\sin(\theta)=\sin(\theta)$
Therefore
$\tan\left(\frac{\pi}{2}-\theta \right) = \frac{\cos(\theta)}{\sin(\theta)}=\cot(\theta)$
A: $\tan\left(\frac{\pi}{2}-\theta\right)=\frac{\sin\left(\frac{\pi}{2}-\theta\right)}{\cos\left(\frac{\pi}{2}-\theta\right)}=\frac{\sin\frac{\pi}{2} \cos\theta-\cos\frac{\pi}{2} \sin\theta}{\\cos\frac{\pi}{2}\cos\theta+\sin\frac{\pi}{2}\sin\theta}=\frac{\cos\theta}{\sin\theta}=\cot\theta.$
