<s>[INST] calculate $\lim\limits_{x \to 1}(1 - x)\tan \frac{\pi x}{2}$ I need to calculate $$\lim_{x \to 1}\left((1 - x)\tan \frac{\pi x}{2}\right)$$.
I used MacLaurin for $\tan$ and got $\frac{\pi x} {2} + o(x)$. Then the full expression comes to $$\lim_{x \to 1}\left(\frac {\pi x} {2} - \frac {\pi x^2} {2} + o(x)\right) = 0$$But WolframAlpha says it should be $\frac 2 \pi$. What am I doing wrong?
 [/INST] We use that  $\tan\theta =\cot\left (\frac{\pi}{2}-\theta\right)$.
Letting $y=\frac{\pi(1-x)}{2}=\frac{\pi}{2}-\frac{\pi}{2}x$, we get that we are seeking:
$$\lim_{y\to 0} \frac{2}{\pi}y\cot y = \frac{2}{\pi}\lim_{y\to 0}\left(\frac{y}{\sin y}\cdot \cos y\right)$$
From there, it should be easy.

Alternatively, note that:
$$\frac{\cot\frac{\pi x}{2}}{1-x} = -\frac{\cot\frac{\pi x}{2}-\cot\frac{\pi}{2}}{x-1}\tag{1}$$
So as $x\to 1$, the limit of $(1)$ as $x\to 1$ is the definition of $-f'(1)$, where $f(x)=\cot\frac{\pi x}{2}$.
But $$(1-x)\cot \frac{\pi x}{2} = \frac{1-x}{\cot\frac{\pi x}{2}}$$ and thus your limit is $-\frac{1}{f'(1)}$. So if you know the derivative of cotangent, you are done.
So if $
</s>