Integration by Parts & Trig Integrals

Recognizing the type before you start

Published

September 3, 2026

The hardest part of these problems is usually not the algebra — it’s figuring out which technique a problem wants before you commit to it. This sheet groups the standard problem types you’ll see this week, with a worked example for each and a few practice problems to try on your own.

Integration by parts, quick reminder

\[ \int u\,dv = uv - \int v\,du \]

Pick \(u\) using LIATE as a rough priority order for what to call \(u\) (Logs, Inverse trig, Algebraic, Trig, Exponential) — whatever is highest on the list is usually the better choice for \(u\), since it should get simpler when you differentiate it.

TipTabular (DI) method

If you know you’ll need IBP two or more times on a polynomial times \(e^x\), \(\sin x\), or \(\cos x\), the tabular method (a “D” column of derivatives, an “I” column of integrals, alternating signs) does the bookkeeping for you and avoids re-deriving the same \(v\) over and over.

IBP — multiple times

When to use it: one factor is a polynomial that eventually differentiates to \(0\) (or a constant), and the other factor is something you can keep integrating (\(e^x\), \(\sin x\), \(\cos x\)). Apply IBP once per degree of the polynomial.

Example. \(\displaystyle \int x^2 e^x\,dx\)

\[ \begin{aligned} u = x^2, \quad dv = e^x\,dx &\implies du = 2x\,dx, \quad v = e^x \\[4pt] \int x^2 e^x\,dx &= x^2 e^x - \int 2x\,e^x\,dx \end{aligned} \]

Now repeat IBP on \(\int 2x\,e^x\,dx\):

\[ u = 2x, \quad dv = e^x\,dx \implies du = 2\,dx, \quad v = e^x \]

\[ \int 2x\,e^x\,dx = 2xe^x - \int 2e^x\,dx = 2xe^x - 2e^x \]

Putting it together:

\[ \int x^2 e^x\,dx = x^2 e^x - 2xe^x + 2e^x + C \]

Practice: \(\displaystyle \int x^2\cos x \,dx\), \(\displaystyle \int x^3 e^{x}\,dx\), \(\displaystyle \int x^2 \sin(3x)\,dx\)

IBP — u‑sub first, then IBP

When to use it: the argument of the function is not just \(x\) (e.g. \(\sqrt{x}\), \(x^2\)), so a plain IBP setup produces a mess. Substitute to clean up the argument first — this will usually change the power out front too — and then do IBP on the new integral.

Example. \(\displaystyle \int \cos(\sqrt{x})\,dx\)

Let \(w = \sqrt{x}\), so \(x = w^2\) and \(dx = 2w\,dw\):

\[ \int \cos(\sqrt{x})\,dx = \int \cos(w)\cdot 2w\,dw = 2\int w\cos(w)\,dw \]

Now this is a standard IBP problem in \(w\):

\[ u = w, \quad dv = \cos(w)\,dw \implies du = dw, \quad v = \sin(w) \]

\[ 2\int w \cos(w)\, dw = 2\Big(w\sin(w) - \int \sin(w)\,dw\Big) = 2w\sin(w) + 2\cos(w) + C \]

Substituting back \(w = \sqrt{x}\):

\[ \int \cos(\sqrt{x})\,dx = 2\sqrt{x}\sin(\sqrt{x}) + 2\cos(\sqrt{x}) + C \]

ImportantDon’t forget to substitute back

It’s easy to finish the IBP in terms of \(w\) and forget to convert back to \(x\) at the end — that’s an incomplete answer.

Practice: \(\displaystyle \int x^5 e^{x^2}\,dx\), \(\displaystyle \int \sin(\sqrt{x})\,dx\), \(\displaystyle \int x^3\cos(x^2)\,dx\) (careful — the last one only needs a u‑sub, no IBP; good for testing whether you can tell the difference)

IBP — do it twice, then solve for the integral

When to use it: IBP twice sends you back to (a multiple of) the original integral instead of to something simpler. When that happens, treat the integral as an unknown \(I\), solve the resulting equation algebraically for \(I\).

Example A. \(\displaystyle I = \int e^x \sin(x)\,dx\)

\[ u = \sin x, \quad dv = e^x\,dx \implies du = \cos x\,dx, \quad v = e^x \]

\[ I = e^x\sin x - \int e^x \cos x\,dx \]

Apply IBP again to \(\int e^x \cos x\,dx\):

\[ u = \cos x, \quad dv = e^x\,dx \implies du = -\sin x\,dx, \quad v = e^x \]

\[ \int e^x \cos x\,dx = e^x \cos x + \int e^x \sin x\,dx = e^x \cos x + I \]

Substitute back into the first line:

\[ I = e^x \sin x - \big(e^x \cos x + I\big) = e^x\sin x - e^x \cos x - I \]

Solve for \(I\):

\[ 2I = e^x(\sin x - \cos x) \implies I = \frac{e^x(\sin x - \cos x)}{2} + C \]

Example B. \(\displaystyle I = \int \sec^3 x\,dx\) (the classic hard one)

\[ u = \sec x, \quad dv = \sec^2 x\,dx \implies du = \sec x\tan x\,dx, \quad v = \tan x \]

\[ I = \sec x \tan x - \int \sec x \tan^2 x\,dx = \sec x\tan x - \int \sec x(\sec^2 x - 1)\,dx \]

\[ I = \sec x \tan x - \int \sec^3 x\,dx + \int \sec x\,dx = \sec x\tan x - I + \ln|\sec x + \tan x| \]

Solve for \(I\):

\[ 2I = \sec x \tan x + \ln|\sec x + \tan x| \implies I = \frac{1}{2}\Big(\sec x \tan x + \ln|\sec x + \tan x|\Big) + C \]

Practice: \(\displaystyle \int e^{2x}\cos x\,dx\), \(\displaystyle \int \sin(x)\cos(x)e^x\,dx\) (hint: simplify with a double-angle identity first), \(\displaystyle \int \sec^3 x\,dx\) redo it on your own without looking

Trig integrals — \(\int \sin^m x \cos^n x\,dx\)

The strategy depends on whether \(m\) or \(n\) is odd.

Sine and cosine, odd power

When to use it: at least one of \(m,n\) is odd. Peel off one factor of the odd power to save for \(du\), convert the remaining even power of that same function to the other function using \(\sin^2 x + \cos^2 x = 1\), then u‑sub.

Example. \(\displaystyle \int \sin^3 x \cos^2 x\,dx\)

The power of sine is odd, so peel off one \(\sin x\):

\[ \int \sin^3 x\cos^2 x\,dx = \int \sin^2 x \cos^2 x \cdot \sin x\,dx = \int (1-\cos^2 x)\cos^2 x \sin x\,dx \]

Let \(u = \cos x\), \(du = -\sin x\,dx\):

\[ = -\int (1-u^2)u^2\,du = -\int (u^2 - u^4)\,du = -\frac{u^3}{3} + \frac{u^5}{5} + C \]

\[ \int \sin^3 x \cos^2 x\,dx = -\frac{\cos^3 x}{3} + \frac{\cos^5 x}{5} + C \]

Practice: \(\displaystyle \int \sin^5 x\,dx\), \(\displaystyle \int \cos^3 x \sqrt{\sin x}\,dx\), \(\displaystyle \int \sin^2 x \cos^3 x\,dx\)

Sine and cosine, even power

When to use it: both \(m\) and \(n\) are even (no odd power to peel off, so the substitution trick above doesn’t apply). Use the power‑reducing identities

\[ \sin^2 x = \frac{1-\cos(2x)}{2}, \qquad \cos^2 x = \frac{1+\cos(2x)}{2} \]

to rewrite everything in terms of \(\cos(2x)\), expand, and integrate term by term (you may need to apply the identities more than once).

Example. \(\displaystyle \int \sin^2 x \cos^2 x\,dx\)

\[ \int \sin^2 x\cos^2 x\,dx = \int \frac{1-\cos 2x}{2}\cdot\frac{1+\cos 2x}{2}\,dx = \frac{1}{4}\int \big(1-\cos^2 2x\big)\,dx \]

That’s still an even power of cosine, so reduce again with \(\cos^2(2x) = \frac{1+\cos(4x)}{2}\):

\[ = \frac{1}{4}\int \left(1 - \frac{1+\cos 4x}{2}\right)dx = \frac{1}{8}\int (1-\cos 4x)\,dx = \frac{x}{8} - \frac{\sin 4x}{32} + C \]

Practice: \(\displaystyle \int \sin^2 x\,dx\), \(\displaystyle \int \cos^4 x\,dx\), \(\displaystyle \int \sin^4 x \cos^2 x\,dx\)

Trig integrals — \(\int \tan^m x \sec^n x\,dx\)

The strategy depends on which of \(m\) (tangent) or \(n\) (secant) you can peel a factor off of, using \(\sec^2 x = 1+\tan^2 x\) to swap between them. The two “easy” cases are:

Tan and secant, odd power (of tangent)

When to use it: the power of tangent is odd. Peel off one factor of \(\sec x \tan x\,dx\) (which is exactly \(d(\sec x)\)) to save for the substitution, convert the remaining even power of tangent to secant using \(\tan^2 x = \sec^2 x - 1\), then let \(u=\sec x\).

Example. \(\displaystyle \int \tan^3 x \sec x\,dx\)

\[ \int \tan^3 x \sec x\,dx = \int \tan^2 x \cdot \sec x \tan x\,dx = \int (\sec^2 x - 1)\sec x\tan x\,dx \]

Let \(u = \sec x\), \(du = \sec x \tan x\,dx\):

\[ = \int (u^2-1)\,du = \frac{u^3}{3} - u + C = \frac{\sec^3 x}{3} - \sec x + C \]

Practice: \(\displaystyle \int \tan^3 x \sec^3 x\,dx\), \(\displaystyle \int \tan^5 x \sec x\,dx\), \(\displaystyle \int \tan^3 x\,dx\) (hint: write \(\sec^0 x = 1\))

Tan and secant, even power (of secant)

When to use it: the power of secant is even. Peel off one factor of \(\sec^2 x\,dx\) (which is exactly \(d(\tan x)\)) to save for the substitution, convert the remaining even power of secant to tangent using \(\sec^2 x = 1+\tan^2 x\), then let \(u = \tan x\).

Example. \(\displaystyle \int \tan^2 x \sec^4 x\,dx\)

\[ \int \tan^2 x \sec^4 x\,dx = \int \tan^2 x \sec^2 x \cdot \sec^2 x\,dx = \int \tan^2 x\,(1+\tan^2 x)\sec^2 x\,dx \]

Let \(u = \tan x\), \(du = \sec^2 x\,dx\):

\[ = \int u^2(1+u^2)\,du = \int (u^2+u^4)\,du = \frac{u^3}{3}+\frac{u^5}{5}+C = \frac{\tan^3 x}{3} + \frac{\tan^5 x}{5} + C \]

Practice: \(\displaystyle \int \sec^4 x\,dx\), \(\displaystyle \int \tan^4 x \sec^4 x\,dx\), \(\displaystyle \int \sec^2 x\tan x\,dx\) (this one also works as a plain u‑sub — notice both approaches agree)

WarningThe leftover case: tangent even, secant odd

If the power of tangent is even and the power of secant is odd (e.g. \(\int \tan^2 x \sec x\,dx\), or \(\int \sec^3 x\,dx\) itself), neither substitution above works — there’s no spare factor to peel off that matches a clean \(du\). Convert all the tangents to secants with \(\tan^2 x = \sec^2 x - 1\) and you’ll be left with pure powers of \(\sec x\), which reduce down to \(\int \sec^3 x\,dx\) and \(\int \sec x\,dx\) — exactly the IBP‑twice technique from above.

Quick reference

Integral Odd power present? Strategy
\(\int \sin^m x\cos^n x\,dx\) \(m\) or \(n\) odd peel one off, Pythagorean identity, u‑sub
\(\int \sin^m x\cos^n x\,dx\) both even power‑reducing (double‑angle) identities
\(\int \tan^m x\sec^n x\,dx\) \(m\) (tangent) odd peel off \(\sec x\tan x\,dx\), \(u=\sec x\)
\(\int \tan^m x\sec^n x\,dx\) \(n\) (secant) even peel off \(\sec^2 x\,dx\), \(u=\tan x\)
\(\int \tan^m x\sec^n x\,dx\) \(m\) even, \(n\) odd convert to pure \(\sec x\), use IBP‑twice / reduction formula