Skip to content
ihateDesmos

Integral of cot x

Updated 6 November 2026 · Checked numerically by the ihateDesmos engine
The integral of cot x
∫
cot(x)
dx =
ln(|sin(x)|)+C

The integral of cot x is ln|sin x| + C. Writing cot x as cos x / sin x shows that the top is the derivative of the bottom.

0.51.01.52.02.53.0−4−224
Open in calculator
y=cot(x)
in blue and its integral
y=ln(|sin(x)|)
(with C = 0) in red. Defined for x ≠ nπ.

How to integrate cot x

Method: u-substitution.

  1. 1
    Write the integrand as a fraction: cot x = cos x / sin x.
  2. 2
    Let u = sin x, so du = cos x dx.
  3. 3
    The integral becomes ∫(1/u) du = ln|u|.
  4. 4
    Substitute back: ln|sin x| + C.

What it means

cot x is positive up to π/2 and negative after it, so ln|sin x| rises to its maximum of 0 at π/2, then falls away, heading to −∞ at 0 and π.

The integral from π/4 to π/2

Using the antiderivative: F(π/2) − F(π/4) = (ln 2)/2, which is about ln 2/2. A direct numerical integration of cot x gives ln 2/2, which agrees.

0.511.522.53−5−4−3−2−112345

Check by differentiating

The derivative of the answer should give back the original function. The last column measures that slope directly from the answer, and it matches.

Checking the integral
xcot xSlope of the answer
1/21.830491.83049
π/411
π/200
2−0.457658−0.457658
13/5−1.66224−1.66224

Common mistakes

  • Writing −csc²x, which is the derivative of cot x, not its integral.

Frequently asked questions

What is the integral of cot x?
The integral of cot x is ln|sin x| + C, for x ≠ nπ.
What is the integral of cot x from π/4 to π/2?
(ln 2)/2, which is about ln 2/2.

Keep going

Integrate any function

Type your own function into the integral calculator for the steps, the answer and a graph.

Open the integral calculator