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.

$\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.$
