<s>[INST] Help Evaluating $\lim_{x\to\frac{\pi}{2}}\left(\frac{1}{\frac{\pi}{2}-x}-\tan {x}\right)$ Does anyone know how to evaluate the following limit?
$$\lim_{x\to\frac{\pi}{2}}\left(\frac{1}{\frac{\pi}{2}-x}-\tan {x}\right)$$
The answer is 0 , but I want to see a step by step solution if possible.
 [/INST] Here are the steps 
$$
\lim_{x\to \frac{\pi}{2}} \left[\frac{1}{\frac{\pi}{2}-x}-\tan x\right]= \lim_{x\to \frac{\pi}{2}} \left[\frac{2}{\pi-2x}-\frac{\sin x}{\cos x}\right]
$$
$$
= \lim_{x\to \frac{\pi}{2}} \left[\frac{2\cos x-(\pi-2x)\sin x}{(\pi-2x)\cos x}\right]= \lim_{x\to \frac{\pi}{2}} \left[\frac{\frac{d}{dx}[2\cos x-(\pi-2x)\sin x]}{\frac{d}{dx}[(\pi-2x)\cos x]}\right]
$$
$$
= \lim_{x\to \frac{\pi}{2}} \left[\frac{-2\sin x-(\pi-2x)\cos x+2\sin x}{-(\pi-2x)\sin x-2\cos x}\right] = \lim_{x\to \frac{\pi}{2}} \left[\frac{\frac{d}{dx}[(\pi-2x)\cos x]}{\frac{d}{dx}[(\pi-2x)\sin x+2\cos x]}\right]
$$
$$
= \lim_{x\to \frac{\pi}{2}} \left[\frac{-(\pi-2x)\sin x-2\cos x}{(\pi-2x)\cos x-2\sin x-2\sin x}\right] = \lim_{x\to \frac{\pi}{2}} \left[\frac{(\pi-2x)\sin x+2\cos x}{4\sin x -(\pi-2x)\cos x}\right]
$$
$$
= \frac{0\cdot 1+2\cdot 0}{4\cdot 1 -0\cdot 0}= \frac{0}{4}=0
$$
</s>