Failure of L’Hospital’s rule to $\lim_{x\rightarrow\infty} x\left(\arctan\left(\frac{x+1}{x+2}\right)-\frac\pi 4\right)$? I rewrote the limit
$$\lim_{x\rightarrow\infty} x\left(\arctan\left(\frac{x+1}{x+2}\right)-\frac\pi 4\right) =\lim_{x\rightarrow\infty} \frac{\left(\arctan\left(\frac{x+1}{x+2}\right)-\frac\pi 4\right)}{\frac 1x},$$
noting that both the numerator and denominator tend to zero as $x\rightarrow \infty$ so that the conditions for L’Hospital’s rule are fulfilled. However, differentiating top and bottom then yields:
$$\lim_{x\rightarrow\infty} \frac{\left(\arctan\left(\frac{x+1}{x+2}\right)-\frac\pi 4\right)}{\frac 1x}=\lim_{x\rightarrow\infty} \frac{\frac{1}{1+\left(\frac{x+1}{x+2}\right)^2}}{-\frac 1{x^2}}=\lim_{x\rightarrow\infty} \frac{-x^2(x+2)^2}{(x+2)^2+(x+1)^2}=\infty,$$
which is incorrect. What went wrong?

You forgot to use chain rule in the numerator:
$\frac{d}{dx}(arctan(\frac{x+1}{x+2})-\frac{\pi}{4}) = \dfrac{\frac{x+2-(x+1)}{(x+2)^2}}{1+(\frac{x+1}{x+2})^2} = \frac{1}{(x+2)^2+(x+1)^2}$
Now the limit exists.
