Find lim as x to pi (pi-x) tan x/2
Find $\displaystyle\lim_{x\to\pi}\bigl(\pi-x\bigr)\tan\frac{x}{2}$.
Explanation of Method
A shift of the variable turns the tangent into a cotangent.
Step 1: Identify the indeterminate form
As $x\to\pi$ the factor $\pi-x$ tends to $0$, while $\tan\dfrac{x}{2}$ becomes infinite: it runs to $+\infty$ as $x\to\pi^{-}$ and to $-\infty$ as $x\to\pi^{+}$. In either case the product is of the form $0\cdot\infty$.
Step 2: Substitute $t = \pi-x$
Put $t = \pi-x$, so that $x = \pi-t$ and $t\to0$. Then
\[ \frac{x}{2} = \frac{\pi-t}{2} = \frac{\pi}{2}-\frac{t}{2}, \qquad \tan\frac{x}{2} = \tan\left(\frac{\pi}{2}-\frac{t}{2}\right) = \cot\frac{t}{2}, \]
and the expression becomes
\[ \bigl(\pi-x\bigr)\tan\frac{x}{2} = t\cot\frac{t}{2} = \frac{t}{\tan\dfrac{t}{2}}. \tag{1} \]
Step 3: Evaluate by the standard equivalence
Since $\tan u\sim u$ as $u\to0$, with $u = \dfrac{t}{2}$: $\frac{t}{\tan\dfrac{t}{2}} \sim \frac{t}{\dfrac{t}{2}} = 2$.
Step 4: The same by l'Hôpital's rule
Expression (1) is of the form $\dfrac00$, and $\dfrac{d}{dt}\tan\dfrac{t}{2} = \dfrac{1}{2\cos^{2}\dfrac{t}{2}}$, so
\[ \lim_{t\to0}\frac{t}{\tan\dfrac{t}{2}} = \lim_{t\to0}\frac{1}{\dfrac{1}{2\cos^{2}\dfrac{t}{2}}} = \lim_{t\to0}2\cos^{2}\frac{t}{2} = 2\cos^{2}0 = 2. \]
Step 5: Verification
\[x = \pi-0.1:\ 1.9983331; \qquad x = \pi+0.1:\ 1.9983331 \;\;\checkmark\]
\[x = \pi\pm0.01:\ 1.9999833 \;\;\checkmark\]
\[\text{Both signs of } \tan\tfrac{x}{2} \text{ are matched by the sign of } \pi-x,\ \text{so the limit is two-sided} \;\;\checkmark\]
Result
Final answer:
\[\boxed{\,\lim_{x\to\pi}\bigl(\pi-x\bigr)\tan\frac{x}{2} = 2\,}\]
Remark
Remark. The value $2$ is the reciprocal of the coefficient $\tfrac12$ in the half-angle: replacing $\tan\dfrac{x}{2}$ by $\tan\dfrac{x}{k}$ would give $k$ in place of $2$. The substitution $t=\pi-x$ does the essential work, moving the trouble from $x = \pi$, where the tangent is undefined, to $t = 0$, where every standard equivalence is available.