AP Calculus AB and BC

Integral of cot x: Answer, u-Substitution, Mistakes

The integral of cot x is ln|sin x| + C. Since cot x = cos x / sin x, the substitution u = sin x gives du = cos x dx and turns the integral into the integral of 1/u du, which is ln|u| + C. The absolute value is required because sin x is negative on some intervals, and the answer must stay defined there too.

cotxdx=lnsinx+C\int \cot x\,dx = \ln\left|\sin x\right| + C

How to integrate cot x with a substitution

By definition cotx=cosxsinx\cot x = \frac{\cos x}{\sin x}, so rewriting is the whole first step. Once it is written that way, the numerator is exactly the derivative of the denominator, and that pattern is the signal for a substitution.

cotxdx=cosxsinxdx\int \cot x\,dx = \int \frac{\cos x}{\sin x}\,dx

Let u=sinxu = \sin x. Then du=cosxdxdu = \cos x\,dx, which is the numerator and the differential together, so nothing is left over.

u=sinx,du=cosxdxu = \sin x, \qquad du = \cos x\,dx

Substituting collapses the integrand to the basic reciprocal form, whose antiderivative is the natural log of the absolute value.

cosxsinxdx=1udu=lnu+C\int \frac{\cos x}{\sin x}\,dx = \int \frac{1}{u}\,du = \ln\left|u\right| + C

Back-substitute u=sinxu = \sin x to finish.

cotxdx=lnsinx+C\int \cot x\,dx = \ln\left|\sin x\right| + C

Check it by differentiating

The chain rule form ddx[lnu]=uu\frac{d}{dx}\left[\ln\left|u\right|\right] = \frac{u'}{u} with u=sinxu = \sin x gives cosxsinx=cotx\frac{\cos x}{\sin x} = \cot x, which is the original integrand. Differentiating your answer is the fastest self-check on any substitution problem.

Why the absolute value is not optional

The antiderivative of 1u\frac{1}{u} is lnu+C\ln\left|u\right| + C, not lnu+C\ln u + C, because ln\ln accepts only positive inputs. Here u=sinxu = \sin x, and sinx\sin x is negative on intervals such as (π,2π)(\pi, 2\pi). Writing ln(sinx)\ln(\sin x) would make the answer undefined on exactly the intervals where cotx\cot x is perfectly well behaved.

The domain lines up neatly: cotx\cot x is undefined precisely where sinx=0\sin x = 0, that is at x=kπx = k\pi for integer kk, and lnsinx\ln\left|\sin x\right| is undefined at the same points. So the formula is valid on each open interval between consecutive multiples of π\pi, and an antiderivative is only ever claimed on one such interval at a time.

A definite integral is fine as long as the interval stays inside one branch. For instance, on [π6,π2]\left[\frac{\pi}{6}, \frac{\pi}{2}\right] the sine never vanishes.

π/6π/2cotxdx=lnsinπ2lnsinπ6=ln1ln12=ln2\int_{\pi/6}^{\pi/2} \cot x\,dx = \ln\left|\sin \frac{\pi}{2}\right| - \ln\left|\sin \frac{\pi}{6}\right| = \ln 1 - \ln \frac{1}{2} = \ln 2

Do not integrate across a singularity

An integral such as π/43π/4\int_{\pi/4}^{3\pi/4} is fine, but π/23π/2cotxdx\int_{\pi/2}^{3\pi/2} \cot x\,dx crosses x=πx = \pi, where the integrand blows up. Plugging the endpoints into lnsinx\ln\left|\sin x\right| there produces a number, and that number is meaningless. Check that sinx0\sin x \neq 0 everywhere on the interval before applying the Fundamental Theorem.

Where the integral of cot x shows up on the AP exam

This is a Unit 6 result (Integration and Accumulation of Change), which carries a weighting of 15 to 20 percent on both AB and BC. Specifically it is Topic 6.9, Integrating Using Substitution, and it is one of the standard examples of a substitution that turns a quotient into a logarithm.

The reusable idea is broader than this one integral. Any time the numerator is the derivative of the denominator, the same move applies and the answer is a log.

uudx=lnu+C\int \frac{u'}{u}\,dx = \ln\left|u\right| + C

The companion result is tanxdx=lncosx+C\int \tan x\,dx = -\ln\left|\cos x\right| + C, which comes from u=cosxu = \cos x and picks up a minus sign because ddx[cosx]=sinx\frac{d}{dx}[\cos x] = -\sin x. Cotangent has no minus sign because the derivative of sine is a clean +cosx+\cos x. Keeping those two straight is worth more points than memorizing either one alone.

  • Free response: a uu-substitution step buried inside an accumulation or area problem, where cotx\cot x or a cosxsinx\frac{\cos x}{\sin x} quotient appears after simplification.
  • Multiple choice: recognizing cosxsinxdx\int \frac{\cos x}{\sin x}\,dx without being handed the word cotangent.
  • BC only: the same log pattern reappears in partial fractions (Topic 6.12), where every piece integrates to a lnu\ln\left|u\right| term.

Equivalent forms of the answer

Log identities let the same antiderivative be written several ways, and all of them are correct. If a solution key looks different from yours, check whether it is one of these before assuming you made an error.

lnsinx+C=lncscx+C\ln\left|\sin x\right| + C = -\ln\left|\csc x\right| + C

The equality holds because cscx=1sinx\csc x = \frac{1}{\sin x}, and ln\ln of a reciprocal is the negative of the log. Some textbooks prefer the cosecant form so that the trig integrals of tanx\tan x, cotx\cot x, secx\sec x, and cscx\csc x all read as logs of reciprocal functions.

Constants can hide differences

Two antiderivatives of the same function can differ by a constant and both be right. If you get ln2sinx+C\ln\left|2\sin x\right| + C, that equals lnsinx+ln2+C\ln\left|\sin x\right| + \ln 2 + C, and the extra ln2\ln 2 is absorbed into the arbitrary constant.

Common mistakes with the integral of cot x

  • Dropping the absolute value. ln(sinx)\ln(\sin x) is undefined wherever sinx<0\sin x < 0, so it is not a valid antiderivative of cotx\cot x on those intervals. Write lnsinx+C\ln\left|\sin x\right| + C.
  • Copying the tangent sign. tanxdx=lncosx+C\int \tan x\,dx = -\ln\left|\cos x\right| + C has a minus; cotxdx=lnsinx+C\int \cot x\,dx = \ln\left|\sin x\right| + C does not. Track where the minus comes from, namely the derivative of the inside function.
  • Confusing the integral with the derivative. ddx[cotx]=csc2x\frac{d}{dx}[\cot x] = -\csc^2 x, which has nothing to do with lnsinx\ln\left|\sin x\right|. Read the problem before reaching for a memorized formula.
  • Reaching for integration by parts. Nothing here needs it; the integrand is already a uu\frac{u'}{u} quotient, and a substitution finishes in one line.
  • Forgetting +C+ C on an indefinite integral. AP readers deduct for it, and it is the cheapest point on the exam to lose.
  • Evaluating a definite integral straight through x=kπx = k\pi. The integrand is undefined there, so the Fundamental Theorem does not apply and the resulting number is not the integral.

Every answer on this page is machine checked

An automated test differentiates the antiderivative above and confirms it returns the integrand. A wrong sign or a missing factor fails the build, so it cannot reach you.

Frequently asked questions

What is the integral of cot x?

cotxdx=lnsinx+C\int \cot x\,dx = \ln\left|\sin x\right| + C. It comes from rewriting cotx\cot x as cosxsinx\frac{\cos x}{\sin x} and substituting u=sinxu = \sin x, so that du=cosxdxdu = \cos x\,dx and the integral becomes 1udu\int \frac{1}{u}\,du.

Why does the integral of cot x need absolute value bars?

Because ln\ln is defined only for positive inputs, while sinx\sin x is negative on intervals such as (π,2π)(\pi, 2\pi). The antiderivative of 1u\frac{1}{u} is lnu+C\ln\left|u\right| + C, so the bars keep the answer defined on every interval where cotx\cot x itself is defined.

What is the difference between the integrals of tan x and cot x?

tanxdx=lncosx+C\int \tan x\,dx = -\ln\left|\cos x\right| + C and cotxdx=lnsinx+C\int \cot x\,dx = \ln\left|\sin x\right| + C. Tangent picks up a minus sign because ddx[cosx]=sinx\frac{d}{dx}[\cos x] = -\sin x, while cotangent does not, because ddx[sinx]=cosx\frac{d}{dx}[\sin x] = \cos x.

Can I write the answer as negative ln of the absolute value of csc x?

Yes. Since cscx=1sinx\csc x = \frac{1}{\sin x}, the identity ln1a=lna\ln\frac{1}{a} = -\ln a gives lncscx+C=lnsinx+C-\ln\left|\csc x\right| + C = \ln\left|\sin x\right| + C. Both forms are correct and equally acceptable on the AP exam.

Is the integral of cot x on the AP Calculus AB exam?

Yes. It is a Unit 6 substitution result (Topic 6.9, Integrating Using Substitution) and appears on both AB and BC. Unit 6 carries a weighting of 15 to 20 percent on each exam.