practicecalculus
Trigonometric integrals

Integral of cot x: Formula, Derivation and Examples

The integral of cot x is ln|sin x| + C. See the u-substitution with u = sin x, how it pairs with tan x, plus cot(ax), cot² x and definite integral examples.

Trigonometric integrals Updated 2 min read

At a glance

\int \cot x\,dx = \ln\lvert\sin x\rvert + C
Antiderivative
\ln\lvert\sin x\rvert + C
Equivalent form
-\ln\lvert\csc x\rvert + C
Method
Rewrite as \dfrac{\cos x}{\sin x}, then u = \sin x
Linear form
\int\cot(ax)\,dx = \dfrac{1}{a}\ln\lvert\sin(ax)\rvert + C
Check
\dfrac{d}{dx}\ln\lvert\sin x\rvert = \cot x
On this page
  1. Graph of cot x and its antiderivative
  2. Derivation, step by step
  3. Check by differentiating
  4. Comparing tan and cot
  5. Definite integrals
  6. Substitution variants
  7. Common mistakes

The integral of \cot x is \ln\lvert\sin x\rvert + C. It comes from one substitution and is the mirror image of the integral of tan x.

\int \cot x\,dx = \ln\lvert\sin x\rvert + C

Graph of cot x and its antiderivative

Area under y = cot x from π/6 to π/2, with the antiderivative y = ln|sin x|
The shaded area is \ln 2 \approx 0.693. The dashed antiderivative reaches its maximum of 0 at x = \frac{\pi}{2}, exactly where \cot x crosses zero.

Derivation, step by step

  1. Rewrite: \displaystyle\int\cot x\,dx = \int\frac{\cos x}{\sin x}\,dx.
  2. Let u = \sin x. Then du = \cos x\,dx.
  3. Substitute: \displaystyle\int\frac{du}{u} = \ln\lvert u\rvert + C.
  4. Put u = \sin x back: \ln\lvert\sin x\rvert + C.

Step 3 is the integral of 1/x. Because \ln\lvert\sin x\rvert = -\ln\lvert\csc x\rvert, some books write the answer as -\ln\lvert\csc x\rvert + C. It is the same function.

Check by differentiating

\frac{d}{dx}\ln\lvert\sin x\rvert = \frac{\cos x}{\sin x} = \cot x \checkmark

The forward direction is different: the derivative of cot x is -\csc^2 x.

Comparing tan and cot

\tan x \cot x
Rewrite \frac{\sin x}{\cos x} \frac{\cos x}{\sin x}
Substitution u = \cos x, du = -\sin x\,dx u = \sin x, du = \cos x\,dx
Integral -\ln\lvert\cos x\rvert + C \ln\lvert\sin x\rvert + C
Derivative \sec^2 x -\csc^2 x

The minus sign shows up for \tan x but not for \cot x, because \cos x differentiates to -\sin x while \sin x differentiates to +\cos x.

Definite integrals

\int_{\pi/6}^{\pi/2}\cot x\,dx = \ln 1 - \ln\frac{1}{2} = \ln 2
\int_{\pi/4}^{\pi/2}\cot x\,dx = 0 - \ln\frac{\sqrt{2}}{2} = \frac{1}{2}\ln 2

Starting at x = 0 gives a divergent improper integral, since \ln\sin x \to -\infty as x \to 0^+.

Substitution variants

\int\cot(ax + b)\,dx = \frac{1}{a}\ln\lvert\sin(ax + b)\rvert + C

Example 1. \int\cot(4x)\,dx = \frac{1}{4}\ln\lvert\sin 4x\rvert + C.

Example 2. \int x\cot(x^2)\,dx = \frac{1}{2}\ln\lvert\sin(x^2)\rvert + C, with u = x^2.

Example 3: cot squared. Use \cot^2 x = \csc^2 x - 1:

\int\cot^2 x\,dx = \int(\csc^2 x - 1)\,dx = -\cot x - x + C

Check: \frac{d}{dx}(-\cot x - x) = \csc^2 x - 1 = \cot^2 x.

Example 4: a hidden cot. \int\frac{\cos x}{3\sin x + 2}\,dx = \frac{1}{3}\ln\lvert 3\sin x + 2\rvert + C, with u = 3\sin x + 2.

Common mistakes

  1. Answering -\csc^2 x. That is the derivative of \cot x.
  2. Adding a minus sign by analogy with \tan x. -\ln\lvert\sin x\rvert has derivative -\cot x.
  3. Answering \ln\lvert\cos x\rvert. The log goes on the denominator of \frac{\cos x}{\sin x}, which is \sin x.
  4. Dropping the absolute value. \sin x < 0 on (\pi, 2\pi).

Practise with u-substitution problems.

Practice it now

U-substitution

Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.

Practice this lesson

Frequently asked questions

What is the integral of cot x?

The integral of \cot x is \ln\lvert\sin x\rvert + C.

What is the integral of cos x / sin x?

That is \cot x, so the integral is \ln\lvert\sin x\rvert + C.

What is the integral of cot(2x)?

It is \frac{1}{2}\ln\lvert\sin 2x\rvert + C.

What is the integral of cot x from π/6 to π/2?

It is \ln\sin\frac{\pi}{2} - \ln\sin\frac{\pi}{6} = 0 - \ln\frac{1}{2} = \ln 2 \approx 0.693.

Written by the PracticeCalculus team

We build interactive calculus lessons and write every page to be clear and correct. Spotted something off? Tell us and we will fix it.