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?
 A: Since you didn't post how you reached your result, I or anyone else, cannot pinpoint where your error is. Here is how I would approach this limit
$$\lim\limits_{x \to 1}\left[(1 - x)\tan\left(\frac{\pi }{2}x\right)\right]$$
Let $n=1-x$, then
$$\lim\limits_{n \to 0}\left[n\tan\left(\frac{\pi}{2}(1-n)\right)\right]$$
$$=\lim\limits_{n \to 0}\left[n\tan\left(\frac{\pi}{2}-\frac{\pi}{2}n\right)\right]$$
$$=\lim\limits_{n \to 0}\left[n\cot\left(\frac{\pi}{2}n\right)\right]$$
$$=\lim\limits_{n \to 0}\left[n\left(\frac{1+\cos(\pi n)}{\sin(\pi n)}\right)\right]$$
$$=\frac{1}{\pi}\left(\lim\limits_{n \to 0}\frac{\pi n}{\sin(\pi n)}\right)\left(1+\lim\limits_{n\to 0}\cos(\pi n)\right)$$
$$=\frac{2}{\pi}$$
A: 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 $
A: $L=\lim\limits_{x \to 1}((1 - x)\tan \frac{\pi x}{2})$
$L=\lim\limits_{(x-1) \to 0}((1 - x)\cot(\frac{\pi }{2}- \frac{\pi x}{2}))$
$L=\frac{2 }{\pi}\lim\limits_{\frac{\pi }{2}(x-1) \to 0}(\frac{\pi }{2}(1 - x)(-)\frac{cos\frac{\pi }{2}(x- 1)}{sin\frac{\pi }{2}(x- 1)})$
$L=\frac{2 }{\pi}\lim\limits_{\frac{\pi }{2}(x-1) \to 0}(\frac{\pi }{2}(x - 1)\frac{cos\frac{\pi }{2}(x- 1)}{sin\frac{\pi }{2}(x- 1)})$
$L=\frac{2 }{\pi}\lim\limits_{\frac{\pi }{2}(x-1) \to 0}\frac{1}{1}$
$L=\frac{2 }{\pi}$
A: You can rewrite $(1-x)\tan(\frac{\pi x}{2})$ as $\frac{1-x}{\cot(\frac{\pi x}{2})}$. Then you can use L'Hopitals rule to say that $\lim \limits_{x \to 1}\frac{1-x}{\cot(\frac{\pi x}{2})}=\lim \limits_{x \to 1}\frac{-1}{-\frac{\pi}{2} \csc^2(\frac{\pi x}{2})}=\frac{2}{\pi}$
A: Or we can immediately simplify things:
$$\begin{aligned}\lim_{x\to 1}(1-x)\tan\left(\frac\pi2 x\right)&=\lim_{x\to 1}\frac{1-x}{\cot\left(\frac\pi2 x\right)}\\&=\lim_{x\to 1}\frac{1-x}{\tan\left(\frac\pi2(1-x)\right)}\\&=\frac2\pi\lim_{x\to 1}\frac{\frac\pi2(1-x)}{\tan\left(\frac\pi2(1-x)\right)}\\&=\frac2\pi\end{aligned}$$
relying on the manual limit $\lim\limits_{x\to 0}\frac{\tan x}x=1$.
