Derivative of cotx – Derivation, Explanation, and Example

Knowing the derivative of cotx will give us an advantage in differentiating and integrating functions.  Learning about its derivation will also show us how fundamental and trigonometric derivative rules can lead to other derivative rules.

The derivative of cotx is equal to the negative of cosecant squared. We can prove this derivative by rewriting cotx in terms of sine and cosine.

Our goal in this article is to review everything we must need to know to differentiate functions that contain $\cot x$ or $\cot[g(x)]$ in their expressions. By the end of the article, we must:

  • Know how to apply the derivative rule for $\cot x$.
  • Understand how this derivative rule was derived.
  • Learn how to use this rule along with other fundamental and trigonometric derivative rules that we’ve learned in the past.

Let’s go ahead and begin with the formula for $\dfrac{d}{dx} \cot x$.

What is the derivative of cotx?    

The derivative of $\cot x$ is equal to the negative of the square of cosecant.

\begin{aligned}\dfrac{d}{dx} \cot x = -\csc^2 x\end{aligned}

This formula will definitely come in handy when we have functions that contain $\cot x$ within its expression. We can use this formula to differentiate composite functions that contain $\cot x$ as an inner or outer function.

\begin{aligned}f(x) &= \sin x + \cot x\\g(x) &= \sqrt{\cot (3x)}\\h(x) &= \cot (x^2 – 2x + 1)\end{aligned}

These are just some of the many functions that we will need the derivative of $\cot x$ if we want to differentiate them. Of course, for composite functions, chain rule will still apply, so keep that in mind!

How to find the derivative of cotx and functions containing it?

At this point, you may have several derivative rules in your notes, and to help you know the derivative of $\cot x$ by heart, we’ll show you how to differentiate $\cot x$ by first rewriting it as $\dfrac{\cos x}{\sin x}$.

\begin{aligned}\dfrac{d}{dx} \cot x &= \dfrac{d}{dx} \dfrac{\cos x}{\sin x}\end{aligned}

We can now use the quotient rule, $\dfrac{d}{dx} \dfrac{f(x)}{g(x)} = \dfrac{g(x)\dfrac{d}{dx}f(x) – f(x)\dfrac{d}{dx} g(x)}{[g(x)]^2}$, to differentiate the resulting expression.

\begin{aligned}\dfrac{d}{dx}\cot x&= \dfrac{d}{dx}\dfrac{\cos x}{\sin x} \\&= \dfrac{\sin x \dfrac{d}{dx} \cos x- \cos x \dfrac{d}{dx} \sin x}{(\sin x)^2},\phantom{x}\color{Orchid}\text{Quotient Rule}\\&= \dfrac{\sin x ({\color{Orchid}-\sin x})- \cos x({\color{Teal}\cos x})}{(\sin x)^2}, \phantom{x}{\color{Orchid}\text{Derivative of Cosine }}\text{&}\color{Teal}\text{ Derivative of Sine}\\&= \dfrac{-(\cos^2x +\sin^2x)}{(\cos x)^2} \end{aligned}

At this point, we’ll need some trigonometric identities to rewrite the expression.

\begin{aligned}\dfrac{d}{dx} \cot x&= \dfrac{d}{dx}\dfrac{\cos x}{\sin x}\\ &= -\dfrac{\sin^2 x + \cos^2 x}{(\sin x)^2}\\&=-\dfrac{{\color{Orchid}1}}{(\cos x)^2}, \phantom{x}\color{Orchid}\cos^2x +\sin^2x=1\\&=-\left(\dfrac{1}{\sin x} \right )^2\\&= -({\color{Orchid}\csc x})^2,\phantom{x}\color{Orchid}\dfrac{1}{\sin x}=\csc x \end{aligned}

Hence, we’ve shown that $\dfrac{d}{dx} \cot x$ is indeed equal to $-csc^2 x$. Let’s try applying this rule to differentiate $y = \cot (4x)$.

When working with composite functions, make sure to differentiate the inner function as well.  For our problem, we have $\cot x$ as the outer function and $4x$ as the inner function. We can apply the derivative of $\cot x$ and the chain rule to find $y’$.

\begin{aligned}y’&= \dfrac{d}{dx} \cot (4x)\\ &= {\color{Orchid}-\csc^2(4x)} \cdot {\color{Teal}\dfrac{d}{dx} 4x},\phantom{x} {\color{Orchid} \text{Derivative of Cotangent }}\text{&}\color{Teal}\text{ Chain Rule}\\&=- \csc^2(4x) \cdot \left({\color{Orchid}4\dfrac{d}{dx}x }\right ),\phantom{x}\color{Orchid}\text{Constant Multiple Rule}\\&=- \csc^2(4x) \cdot 4\left({\color{Orchid}1}\right ),\phantom{x}\color{Orchid}\text{Power Rule}\\&= -4\csc^2(4x)\end{aligned}

This example clearly shows that it’s important that we know the fundamental derivative rules if we want to differentiate functions like this completely. Don’t worry. We’ve prepared a few more examples for you to work on!

Example 1

Find the derivative of $h(x)= \cot^3 (2x)$.


We can rewrite $h(x)$ as $[\cot (2x)]^3$, so we’ll have to use the power rule then apply the chain rule first to differentiate $h(x)$.

\begin{aligned}h'(x) &= \dfrac{d}{dx} [\cot (2x)]^3\\&= {\color{Orchid}3[\cot (2x)]^{3 – 1}}\cdot {\color{Teal}\dfrac{d}{dx} \cot (2x) },\phantom{x}{\color{Orchid}\text{Power Rule }}\text{&}\color{Teal}\text{ Chain Rule }\\&= 3[\cot(2x)]^2 \cdot {\color{Orchid}-\csc^2(2x)}\cdot{\color{Teal}\dfrac{d}{dx} 2x},\phantom{x}{\color{Orchid}\text{Derivative of Cotangent}}\text{&}\color{Teal}\text{ Chain Rule }\end{aligned}

This shows that there are instances when we’ll have to apply the chain rule successively. Keep this in mind, especially when working with composite functions that contain another composite function within. Let’s continue to differentiate $2x$ to further simplify $h’(x)$.

\begin{aligned}h'(x) &=  3\cot^2(2x) \cdot -\csc^2 (2x) \cdot \left({\color{Orchid}2\dfrac{d}{dx}x} \right ),\phantom{x}\color{Orchid}\text{Constant Multiple Rule}\\&=  -3\cot^2(2x)\csc^2 (2x) \cdot 2\left({\color{Orchid}1} \right ),\phantom{x}\color{Orchid}\text{Power Rule}\\&=-6\cot^2(2x)\csc^2(2x)\end{aligned}

Hence, we have $h’(x) =-6\cot^2(2x)\csc^2(2x)$.

Example 2

Find the derivative of $h(x)= e^x\cot(x^2 + 4)$.


The function $h(x)$ contains two factors: $e^x$ and $\cot(x^2 + 4)$. This means that we can use the product rule, $\dfrac{d}{dx} [f(x) \cdot g(x)] = f(x)g’(x) + g(x)f’(x)$, to differentiate $h(x)$.

\begin{aligned}h’(x) &= \dfrac{d}{dx} [e^x\cot(x^2 + 4)] \\&= e^x \dfrac{d}{dx}\cot(x^2 + 4)+\cot(x^2+4)\dfrac{d}{dx}e^x,\phantom{x}\color{Orchid}\text{Product Rule}\\&=e^x \dfrac{d}{dx}\cot(x^2 + 4)+\cot(x^2+4)\cdot{\color{Orchid}e^x},\phantom{x}\color{Orchid}\dfrac{d}{dx}e^x = e^x\end{aligned}

Let’s focus on $\dfrac{d}{dx} \cot (x^2 + 4)$ for now. We can see that to differentiate this expression; we’ll need the derivative for $\cot x$ and the chain rule.

\begin{aligned}\dfrac{d}{dx} \cot(x^2 + 4) &= {\color{Orchid} – \csc^2(x^2 + 4)}\cdot {\color{Teal}\dfrac{d}{dx} (x^2 + 4)},\phantom{x}{\color{Orchid}\text{Derivative of Contangent }}\text{&}\color{Teal}\text{ Chain Rule}\\&= -\csc^2(x^2 + 4) \cdot \left({\color{Orchid}\dfrac{d}{dx}x^2+\dfrac{d}{dx}4} \right ),\phantom{x}{\color{Orchid}\text{Sum Rule }}\\&=-\csc^2(x^2 + 4)\cdot\left({\color{Orchid}2x} + {\color{Teal}0}\right),\phantom{x}{\color{Orchid}\text{Power Rule }}\text{&}\color{Teal}\text{ Constant Rule}\\&=-2x \csc^2(x^2 + 4)\end{aligned}

We can now go back to our original expression and use $\dfrac{d}{dx} \cot(x^2+4) = -2x\csc^2(x^2 +4)$.

\begin{aligned}h'(x) &=e^x{[-2x\csc^2(x^2 + 4)]}+ e^x\cot(x^2+4)\\&= e^x[-2x\csc^2(x^2 +4)+\cot(x^2+4)]\end{aligned}

This shows that $h’(x) = e^x[-2x\csc^2(x^2 +4)+\cot(x^2+4)]$.

Example 3

Find the derivative of $h(x)= \cot\left(\dfrac{x+1}{x-2}\right)$.


We can use the derivative of $\cot x$ and the chain rule to begin differentiating $h(x)$.

\begin{aligned}h'(x) &=\dfrac{d}{dx}\cot\left(\dfrac{x+1}{x-2}\right)\\&= {\color{Orchid}-\csc^2\left(\dfrac{x+1}{x-2}\right)} \cdot {\color{Teal}\dfrac{d}{dx} \left(\dfrac{x+1}{x-2}\right)},\phantom{x}{\color{Orchid}\text{Derivative of Cotangent }}\text{&}\color{Teal}\text{ Chain Rule}\\&= -\csc^2\left(\dfrac{x + 1}{x – 2} \right ) \cdot \left[{\color{Orchid}\dfrac{(x-2)\dfrac{d}{dx}(x+1) – (x+1)\dfrac{d}{dx}(x-2)}{(x-2)^2}} \right ],\phantom{x}{\color{Orchid}\text{Quotient Rule}}\end{aligned}

We can differentiate $(x+1)$ and $(x-2)$ using the sum, power, and constant rules.

\begin{aligned}\boldsymbol{\dfrac{d}{dx} (x +1)}\end{aligned}\begin{aligned}\boldsymbol{\dfrac{d}{dx} (x -2)}\end{aligned}
\begin{aligned} \dfrac{d}{dx} (x +1) &= \dfrac{d}{dx} x + \dfrac{d}{dx}1,\phantom{x}\color{Orchid}\text{Sum Rule}\\&= {\color{Orchid}1} + {\color{Teal}0} ,\phantom{x}{\color{Orchid}\text{Power Rule }}\text{&}{\color{Teal}\text{ Constant Rule}}\\&= 1\end{aligned}\begin{aligned} \dfrac{d}{dx} (x -2) &= \dfrac{d}{dx} x – \dfrac{d}{dx}2,\phantom{x}\color{Orchid}\text{Sum Rule}\\&= {\color{Orchid}1} – {\color{Teal}0} ,\phantom{x}{\color{Orchid}\text{Power Rule }}\text{&}{\color{Teal}\text{ Constant Rule}}\\&= 1\end{aligned}

Let’s use these results to further simplify $h’(x)$.

\begin{aligned}h'(x) &= -\csc^2\left(\dfrac{x + 1}{x – 2} \right ) \cdot \left[\dfrac{(x-2)1 – (x+1)1}{(x-2)^2} \right ]\\&= -\csc^2\left(\dfrac{x + 1}{x – 2} \right ) \cdot \left[\dfrac{x-2 – x- 1}{(x-2)^2} \right ]\\&= \dfrac{3}{(x – 2)^2}\csc^2\left(\dfrac{x + 1}{x – 2} \right )\end{aligned}

This means that $h’(x) =\dfrac{3}{(x – 2)^2}\csc^2\left(\dfrac{x + 1}{x – 2} \right )$.

Practice Questions

1. Find the derivative of the following functions.
a. $f(x) = \cot (4x -3)$
b. $g(x)= \cot^4 (8x)$
c. $h(x) = \cot (3x^2 – 4x + 1)$
2. Find the derivative of the following functions.
a. $f(x) = \cot[e^x\cot(2x + 1)]$
b. $g(x) = \sqrt{x}\cot(2x^2 – 1)$
c. $h(x)= \sqrt{\cot \left(\dfrac{x – 1}{x + 5}\right)}$

Answer Key

a. $f’(x) = -4\csc^2(4x – 3)$
b. $g’(x) = -32\cot^3 (8x)\csc^2 (8x)$
c. $h’(x)= -\left(6x – 4\right)\csc ^2\left(3x^2 – 4x + 1\right)$
a.$f’(x) = -\csc ^2\left[e^x\cot \left(2x + 1\right)\right]\left[e^x\cot \left(2x +1\right) – 2e^x\csc ^2\left(2x + 1\right]\right)$
b. $g’(x) = \dfrac{\cot \left(2x^2 – 1\right)}{2\sqrt{x}} – 4x\sqrt{x}\csc ^2\left(2x^2 – 1\right)$
c.$h’(x) = -\dfrac{3\csc ^2\left(\frac{x – 1}{x + 5}\right)}{\sqrt{\cot \left(\frac{x – 1}{x + 5}\right)}\left(x + 5\right)^2}$