Find lim as x to pi/2 (x/(cot x)- pi/(2 cos x))
Find $\displaystyle\lim_{x\to\pi/2}\left(\frac{x}{\cot x}-\frac{\pi}{2\cos x}\right)$.
Explanation of Method
Shift to the origin, then one differentiation settles it.
Step 1: Identify the indeterminate form
As $x\to\dfrac{\pi}{2}$ both $\cot x\to0$ and $\cos x\to0$, so each term becomes infinite. The difference is of the form $\infty-\infty$.
Step 2: Substitute $t = x-\dfrac{\pi}{2}$
With $x = \dfrac{\pi}{2}+t$ and $t\to0$, the shift formulas give
\[ \cot x = \cot\left(\frac{\pi}{2}+t\right) = -\tan t, \qquad \cos x = \cos\left(\frac{\pi}{2}+t\right) = -\sin t, \]
so the expression becomes
\[ \frac{\dfrac{\pi}{2}+t}{-\tan t}-\frac{\pi}{2\bigl(-\sin t\bigr)} = -\frac{\dfrac{\pi}{2}+t}{\tan t}+\frac{\pi}{2\sin t}. \tag{1} \]
Step 3: Combine into a single fraction
Using $\dfrac{1}{\tan t} = \dfrac{\cos t}{\sin t}$, both terms acquire the denominator $\sin t$: \[(1) = \frac{\pi}{2\sin t}-\frac{\left(\dfrac{\pi}{2}+t\right)\cos t}{\sin t} = \frac{\dfrac{\pi}{2}-\left(\dfrac{\pi}{2}+t\right)\cos t}{\sin t}. \tag{2}\]
At $t = 0$ the numerator is $\dfrac{\pi}{2}-\dfrac{\pi}{2}\cdot1 = 0$ and the denominator is $0$: the form is $\dfrac00$.
Step 4: Apply l'Hôpital's rule
\[ \frac{d}{dt}\left[\frac{\pi}{2}-\left(\frac{\pi}{2}+t\right)\cos t\right] = -\cos t+\left(\frac{\pi}{2}+t\right)\sin t, \qquad \frac{d}{dt}\bigl[\sin t\bigr] = \cos t, \]
\[ \lim_{t\to0}\frac{\dfrac{\pi}{2}-\left(\dfrac{\pi}{2}+t\right)\cos t}{\sin t} = \lim_{t\to0}\frac{-\cos t+\left(\dfrac{\pi}{2}+t\right)\sin t}{\cos t}. \]
Step 5: Evaluate at $t = 0$
\[ \frac{-\cos0+\dfrac{\pi}{2}\sin0}{\cos0} = \frac{-1+0}{1} = -1. \]
Step 6: Verification
\[t = 0.01:\ -0.9921126; \qquad t = -0.01:\ -1.0078207; \qquad t = 0.001:\ -0.9992143 \;\;\checkmark\]
\[\text{The approach is linear: } \frac{-0.9992143+1}{0.001} = 0.7857 \approx \frac{\pi}{4} \;\;\checkmark\]
\[\text{Indeed the numerator of (2) is } -t+\frac{\pi}{4}t^{2}+\cdots,\ \text{the denominator } t-\frac{t^{3}}{6}+\cdots \;\;\checkmark\]
Result
Final answer:
\[\boxed{\,\lim_{x\to\pi/2}\left(\frac{x}{\cot x}-\frac{\pi}{2\cos x}\right) = -1\,}\]
Remark
Remark. Writing $\dfrac{x}{\cot x} = x\tan x$ shows what the two terms are doing: each is a multiple of $\sec$-type growth near $\dfrac{\pi}{2}$, and they are arranged so that the infinite parts cancel, leaving the derivative-like remainder $-1$. The shift $t = x-\dfrac{\pi}{2}$ is what makes that cancellation visible, since the singularity sits at the origin of the new variable.