Answer
$$\frac{{dy}}{{dx}} = - \frac{1}{{{x^2}}}{\csc ^2}\left( {\pi - \frac{1}{x}} \right)$$
Work Step by Step
$$\eqalign{
& y = \cot \left( {\pi - \frac{1}{x}} \right) \cr
& {\text{differentiate with respect to }}x \cr
& \frac{{dy}}{{dx}} = \frac{d}{{dx}}\left[ {\cot \left( {\pi - \frac{1}{x}} \right)} \right] \cr
& {\text{using the chain rule to }}\frac{d}{{dx}}\left[ {\cot u} \right] = - {\csc ^2}u\frac{{du}}{{dx}} \cr
& \frac{{dy}}{{dx}} = - {\csc ^2}\left( {\pi - \frac{1}{x}} \right)\frac{d}{{dx}}\left[ {\pi - \frac{1}{x}} \right] \cr
& {\text{solving the derivative, we get:}} \cr
& \frac{{dy}}{{dx}} = - {\csc ^2}\left( {\pi - \frac{1}{x}} \right)\left( {\frac{1}{{{x^2}}}} \right) \cr
& \frac{{dy}}{{dx}} = - \frac{1}{{{x^2}}}{\csc ^2}\left( {\pi - \frac{1}{x}} \right) \cr} $$