Certainly you mean something other than the limit... you would not need that formula, and that is not what the limit is equal to:

lim cot(x) as x->pi/4 - Wolfram|Alpha

Perhaps you mean the derivative of cotx? In that case, you want

which is what you have near the end there... I am just clarifying.

Have you learned the derivative of sine and cosine yet?