Is the limit $\lim_{x \to 1}{(2-x)}^{\tan(\pi/2)x}$ undefined? I'm preparing for a calculus exam and came across this limit:
$$\lim_{x \to 1}{(2-x)}^{\tan(\pi/2)x}$$
Of course $\tan(\pi/2)$ is undefined, but the excercise was a multiple choice with options $\infty$, 0, e, $e^\pi$ and $e^{2/\pi}$
So WolframAlpha says $\tan(\pi/2)$ is $\infty$, I figured this is a $1^\infty$ indeterminate and first tried to rewrite it like this:
$$
\lim_{x \to 1}{(1+(1-x))}^{(1-x)^{-1}(1-x)\tan(\pi/2)x}
$$
And I have $$\lim_{x \to 1}{(1+(1-x))}^{(1-x)^{-1}}=e$$
But then I got stuck trying to calculate $$\lim_{x \to 1}(1-x)\tan(\pi/2)x$$
I've also tried other methods but everything I try I end up stuck in a similar situation. Also, all the ways I can think of to calculate this limit seem too far-fetched (including the one above).
So, is the excercise wrong? If it's undefined, is it because of $\tan(\pi/2)$ or is there some other argument?
 A: When it says $\tan(\pi/2)x$, it's meant to be interpreted as $\tan((\pi/2)x)$, not $(\tan(\pi/2))x$ (yes, it is terrible notation).  So the expression $(x-1)\tan((\pi/2)x)$ is a $0\cdot\infty$ indeterminate form as $x\to 1$ and you can try using L'Hopital's rule.  If it were $(\tan(\pi/2))x$, the expression would of course be undefined for all values of $x$, and so it would be meaningless to talk about the limit.
(If this confusion is not what you are actually asking about, apologies and I will delete this answer!)
A: You may write
$$\mathop {\lim }\limits_{x \to 1} {\left( {2 - x} \right)^{\tan \left( {\frac{\pi }{2}x} \right)}} = \mathop {\lim }\limits_{x \to 1} {e^{\tan \left( {\frac{\pi }{2}x} \right)\ln \left( {2 - x} \right)}} = \mathop {\lim }\limits_{x \to 1} {e^{\frac{{\ln \left( {2 - x} \right)}}{{\cot \left( {\frac{\pi }{2}x} \right)}}}} = {e^{\mathop {\lim }\limits_{x \to 1} \frac{{\ln \left( {2 - x} \right)}}{{\cot \left( {\frac{\pi }{2}x} \right)}}}}$$
So lets concentrate on the following limit 
$$\mathop {\lim }\limits_{x \to 1} \frac{{\ln \left( {2 - x} \right)}}{{\cot \left( {\frac{\pi }{2}x} \right)}}$$
You may use the Hopital rule to get
$$\mathop {\lim }\limits_{x \to 1} \frac{{\ln \left( {2 - x} \right)}}{{\cot \left( {\frac{\pi }{2}x} \right)}} = \mathop {\lim }\limits_{x \to 1} \frac{{\frac{{ - 1}}{{2 - x}}}}{{ - \left( {1 + {{\cot }^2}\left( {\frac{\pi }{2}x} \right)} \right)\frac{\pi }{2}}} = \mathop {\lim }\limits_{x \to 1} \frac{1}{{\left( {2 - x} \right)\left( {1 + {{\cot }^2}\left( {\frac{\pi }{2}x} \right)} \right)\frac{\pi }{2}}} = \frac{2}{\pi }$$
So the final answer is
$$\mathop {\lim }\limits_{x \to 1} {\left( {2 - x} \right)^{\tan \left( {\frac{\pi }{2}x} \right)}} = {e^{\frac{2}{\pi }}}$$
and we are done.
A: If we take the log of this function:
$$lim_{x\rightarrow 1} ln(2-x)^{tan\frac{\pi}{2}x} = lim_{x\rightarrow 1} tan(\frac{\pi}{2}x)ln(2-x)$$
$$= lim_{x\rightarrow 1} \frac{ln(2-x)}{cot(\frac{\pi}{2}x)}$$
By L'Hopitals rule:
$$= lim_{x\rightarrow 1} \frac{\frac{-1}{2-x}}{{-csc^2(\frac{\pi}{2}x)*\frac{\pi}{2}}}$$
$$= \frac{\frac{-1}{2-1}}{{-csc^2(\frac{\pi}{2})*\frac{\pi}{2}}}$$
$$= \frac{2}{\pi}$$
But his was the log of our function, so if we raise it to the power e the answer is:
$$lim_{x\rightarrow 1} (2-x)^{tan\frac{\pi}{2}x} = e^{\frac{2}{\pi}}$$
A: Try taking logs, interchanging the limit with the log (this can be done since $\log x$ is a continuous function for $x>0$) and then it may become more obvious.
In other words, let $L=\lim_{x\to1}(2-x)^{\tan\left(\frac{\pi}{2}x\right)}$ and then take logs of both sides. 
To get you started, I have 
$\log L = \log\lim_{x\to1}\left[(2-x)^{\tan\left(\frac{\pi}{2}x\right)}\right] = \lim_{x\to1}\log\left[(2-x)^{\tan\left(\frac{\pi}{2}x\right)}\right]$. 
See if you can use limit and log laws to get something plausible.
A: You can do without taking logarithms too! Do it by writing the limit as follows
$$
\lim_{x\to 1}(1-x)\tan\left(\frac{\pi x}{2}\right) =\lim_{x\to 1} \frac{1-x}{\cot\left(\frac{\pi x}{2}\right)} 
$$
and then apply L'Hopital's rule to get the required answer. It works:
