<s>[INST] 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.
 [/INST] 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)$
</s>