practicecalculus
Integration Techniques

Trig Substitution: The Three Cases, Triangles and Examples

Learn trigonometric substitution: which of the three substitutions to use, how to build the reference triangle, and how to convert the answer back to x.

By the PracticeCalculus team Published 7 min read

On this page
  1. What is trig substitution?
  2. The three trig substitutions
  3. The reference triangles, described in words
  4. The trig substitution method in five steps
  5. Worked example 1: the sine substitution
  6. Worked example 2: area of a quarter circle
  7. Worked example 3: the tangent substitution
  8. Worked example 4: the secant substitution
  9. Worked example 5: converting a double angle back to x
  10. Completing the square first
  11. When not to use trig substitution
  12. Common trig substitution mistakes
  13. Practice the three cases until they click

The integral \int \sqrt{4 - x^2}\,dx looks innocent, yet u-substitution fails (there is no x outside the root to absorb du) and integration by parts goes nowhere. Trig substitution removes the square root entirely by replacing x with a trig function, and it is the standard way to integrate expressions involving \sqrt{a^2 - x^2}, \sqrt{a^2 + x^2} and \sqrt{x^2 - a^2}.

What is trig substitution?

Trigonometric substitution replaces x with a\sin\theta, a\tan\theta or a\sec\theta so that a Pythagorean identity collapses the square root into a single term. For example, with x = 2\sin\theta:

\sqrt{4 - x^2} = \sqrt{4 - 4\sin^2\theta} = \sqrt{4\cos^2\theta} = 2\cos\theta

The root is gone, and you are left with a trig integral. At the end you use a right triangle to rewrite the answer in terms of x.

The three trig substitutions

Expression Substitution dx Identity used Root becomes
\sqrt{a^2-x^2} x = a\sin\theta a\cos\theta\,d\theta 1-\sin^2\theta = \cos^2\theta a\cos\theta
\sqrt{a^2+x^2} x = a\tan\theta a\sec^2\theta\,d\theta 1+\tan^2\theta = \sec^2\theta a\sec\theta
\sqrt{x^2-a^2} x = a\sec\theta a\sec\theta\tan\theta\,d\theta \sec^2\theta-1 = \tan^2\theta a\tan\theta

A quick way to remember: minus x^2 means sine, plus means tangent, and x^2 minus means secant.

The substitutions come with restricted angle ranges (-\frac{\pi}{2} \le \theta \le \frac{\pi}{2} for sine, -\frac{\pi}{2} < \theta < \frac{\pi}{2} for tangent, and 0 \le \theta < \frac{\pi}{2} for secant when x \ge a). On these ranges \cos\theta, \sec\theta and \tan\theta are nonnegative, which is why the square roots simplify without absolute values.

The reference triangles, described in words

To convert back to x, draw a right triangle with angle \theta and label two sides straight from your substitution. The third side comes from the Pythagorean theorem, and it is always the square root from the problem.

  • Sine case, x = a\sin\theta. Since \sin\theta = \frac{x}{a} = \frac{\text{opposite}}{\text{hypotenuse}}, put x on the side opposite \theta and a on the hypotenuse. The adjacent side is \sqrt{a^2 - x^2}.
  • Tangent case, x = a\tan\theta. Since \tan\theta = \frac{x}{a} = \frac{\text{opposite}}{\text{adjacent}}, put x opposite and a adjacent. The hypotenuse is \sqrt{a^2 + x^2}.
  • Secant case, x = a\sec\theta. Since \sec\theta = \frac{x}{a} = \frac{\text{hypotenuse}}{\text{adjacent}}, put x on the hypotenuse and a adjacent. The opposite side is \sqrt{x^2 - a^2}.

Once the triangle is labeled, any trig function of \theta is a ratio of two sides. For instance, in the sine triangle \cot\theta = \frac{\text{adjacent}}{\text{opposite}} = \frac{\sqrt{a^2-x^2}}{x}.

The trig substitution method in five steps

  1. Identify the form and choose the substitution from the table.
  2. Substitute for x, dx and the root.
  3. Simplify and integrate the trig integral in \theta.
  4. Build the triangle from your substitution.
  5. Convert back to x using the triangle (and \theta = \arcsin\frac{x}{a} or similar for any bare \theta).

Worked example 1: the sine substitution

Evaluate \int \frac{dx}{x^2\sqrt{9-x^2}}.

Step 1. Identify the form. \sqrt{9 - x^2} is \sqrt{a^2 - x^2} with a = 3, so let x = 3\sin\theta.

Step 2. Substitute. dx = 3\cos\theta\,d\theta, x^2 = 9\sin^2\theta and \sqrt{9 - x^2} = 3\cos\theta:

\int \frac{3\cos\theta\,d\theta}{9\sin^2\theta\cdot 3\cos\theta} = \frac19\int \frac{d\theta}{\sin^2\theta} = \frac19\int \csc^2\theta\,d\theta

Step 3. Integrate. \int\csc^2\theta\,d\theta = -\cot\theta, so the result is -\frac19\cot\theta + C.

Step 4. Build the triangle. \sin\theta = \frac{x}{3}: opposite x, hypotenuse 3, adjacent \sqrt{9 - x^2}.

Step 5. Convert back. \cot\theta = \frac{\sqrt{9-x^2}}{x}, so

\int \frac{dx}{x^2\sqrt{9-x^2}} = -\frac{\sqrt{9-x^2}}{9x} + C

Worked example 2: area of a quarter circle

Evaluate \int_0^2 \sqrt{4 - x^2}\,dx.

The curve y = \sqrt{4 - x^2} is the top half of the circle of radius 2, so this integral should equal a quarter of the circle's area, \frac14\pi(2)^2 = \pi. Let's confirm it.

Step 1. Let x = 2\sin\theta, so dx = 2\cos\theta\,d\theta and \sqrt{4 - x^2} = 2\cos\theta.

Step 2. Change the bounds. When x = 0, \sin\theta = 0, so \theta = 0. When x = 2, \sin\theta = 1, so \theta = \frac{\pi}{2}.

Step 3. Substitute.

\int_0^{\pi/2} 2\cos\theta\cdot 2\cos\theta\,d\theta = 4\int_0^{\pi/2}\cos^2\theta\,d\theta

Step 4. Use the half-angle identity \cos^2\theta = \frac{1 + \cos 2\theta}{2}:

4\int_0^{\pi/2}\frac{1 + \cos 2\theta}{2}\,d\theta = 2\left[\theta + \tfrac12\sin 2\theta\right]_0^{\pi/2} = 2\left(\tfrac{\pi}{2} + 0\right) - 0 = \pi

Because we changed the bounds, there was no need to convert back to x.

Quarter circle under y = √(4 − x²) from x = 0 to x = 2
The shaded region is a quarter of a circle of radius 2, and trig substitution confirms \int_0^2 \sqrt{4-x^2}\,dx = \pi.

Worked example 3: the tangent substitution

Evaluate \int \frac{dx}{\sqrt{x^2+4}}.

Step 1. The form is \sqrt{a^2 + x^2} with a = 2. Let x = 2\tan\theta.

Step 2. dx = 2\sec^2\theta\,d\theta and \sqrt{x^2 + 4} = \sqrt{4\tan^2\theta + 4} = 2\sec\theta:

\int \frac{2\sec^2\theta\,d\theta}{2\sec\theta} = \int \sec\theta\,d\theta

Step 3. \int\sec\theta\,d\theta = \ln|\sec\theta + \tan\theta| + C.

Step 4. Triangle. \tan\theta = \frac{x}{2}: opposite x, adjacent 2, hypotenuse \sqrt{x^2 + 4}. So \sec\theta = \frac{\sqrt{x^2+4}}{2}.

Step 5. Convert back.

\ln\left|\frac{\sqrt{x^2+4}}{2} + \frac{x}{2}\right| + C = \ln\left(x + \sqrt{x^2+4}\right) - \ln 2 + C

The -\ln 2 is a constant, so it merges into C:

\int \frac{dx}{\sqrt{x^2+4}} = \ln\left(x + \sqrt{x^2+4}\right) + C

Worked example 4: the secant substitution

Evaluate \int \frac{\sqrt{x^2-1}}{x}\,dx for x > 1.

Step 1. The form is \sqrt{x^2 - a^2} with a = 1. Let x = \sec\theta with 0 \le \theta < \frac{\pi}{2}.

Step 2. dx = \sec\theta\tan\theta\,d\theta and \sqrt{x^2 - 1} = \tan\theta:

\int \frac{\tan\theta}{\sec\theta}\cdot\sec\theta\tan\theta\,d\theta = \int\tan^2\theta\,d\theta

Step 3. Use \tan^2\theta = \sec^2\theta - 1:

\int(\sec^2\theta - 1)\,d\theta = \tan\theta - \theta + C

Step 4. Triangle. \sec\theta = x: hypotenuse x, adjacent 1, opposite \sqrt{x^2-1}. So \tan\theta = \sqrt{x^2-1}, and \theta = \operatorname{arcsec} x.

Step 5.

\int \frac{\sqrt{x^2-1}}{x}\,dx = \sqrt{x^2-1} - \operatorname{arcsec} x + C

Worked example 5: converting a double angle back to x

Evaluate \int \frac{x^2}{\sqrt{1-x^2}}\,dx.

Step 1. The form is \sqrt{a^2 - x^2} with a = 1. Let x = \sin\theta.

Step 2. dx = \cos\theta\,d\theta and \sqrt{1 - x^2} = \cos\theta:

\int \frac{\sin^2\theta}{\cos\theta}\cdot\cos\theta\,d\theta = \int \sin^2\theta\,d\theta

Step 3. Use \sin^2\theta = \frac{1 - \cos 2\theta}{2}:

\int \frac{1 - \cos 2\theta}{2}\,d\theta = \frac{\theta}{2} - \frac{\sin 2\theta}{4} + C

Step 4. Rewrite the double angle. The triangle only gives you functions of \theta, not 2\theta, so use \sin 2\theta = 2\sin\theta\cos\theta:

\frac{\theta}{2} - \frac{\sin\theta\cos\theta}{2} + C

Step 5. Convert back. The triangle for \sin\theta = x has opposite x, hypotenuse 1 and adjacent \sqrt{1-x^2}, so \cos\theta = \sqrt{1 - x^2}. And \theta = \arcsin x.

\int \frac{x^2}{\sqrt{1-x^2}}\,dx = \frac{\arcsin x}{2} - \frac{x\sqrt{1-x^2}}{2} + C

Tip: whenever your \theta-answer contains \sin 2\theta or \cos 2\theta, expand it with a double-angle identity before using the triangle.

Completing the square first

If the root holds a general quadratic, complete the square to reach one of the three forms. For \int \frac{dx}{\sqrt{x^2 + 2x + 5}}:

x^2 + 2x + 5 = (x+1)^2 + 4

Let u = x + 1 (so du = dx). The integral becomes \int \frac{du}{\sqrt{u^2 + 4}}, which is exactly example 3:

\int \frac{dx}{\sqrt{x^2+2x+5}} = \ln\left(x + 1 + \sqrt{x^2+2x+5}\right) + C

When not to use trig substitution

Always check for a simpler method first. In \int \frac{x}{\sqrt{9 - x^2}}\,dx, the factor x is (up to a constant) the derivative of 9 - x^2, so u-substitution with u = 9 - x^2 gives -\sqrt{9 - x^2} + C in two lines. Trig substitution would work, but it is the long way around. Similarly, a rational function with no root is usually a job for partial fractions.

Common trig substitution mistakes

  1. Picking the wrong substitution. \sqrt{x^2 - 9} needs secant, not sine. Match the sign pattern carefully.
  2. Forgetting to substitute dx. dx becomes a\cos\theta\,d\theta (or the matching expression), not d\theta.
  3. Leaving the answer in \theta. An indefinite integral must end in x. Use the triangle.
  4. Mislabeling the triangle. Write the defining ratio (\sin\theta = \frac{x}{a}, for example) and place sides from it, rather than from memory.
  5. Using old bounds. For definite integrals, convert the bounds to \theta values, or convert back to x before evaluating.

Practice the three cases until they click

Trig substitution has a lot of moving parts, but every problem follows the same five steps. The fastest way to get comfortable is to do several problems in a row so the triangles become automatic. The interactive lesson below gives you instant feedback on each substitution and shows the triangle whenever you get stuck.

Practice it now

Trig 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

When do you use trig substitution?

Use it when an integrand contains \sqrt{a^2 - x^2}, \sqrt{a^2 + x^2} or \sqrt{x^2 - a^2} (or those expressions raised to a power) and a simple u-substitution does not work. The substitution removes the square root using a Pythagorean identity.

How do you know which trig substitution to use?

Match the form under the root. A constant minus x^2 uses sine, a constant plus x^2 uses tangent, and x^2 minus a constant uses secant. In each case the identity 1 - \sin^2\theta = \cos^2\theta, 1 + \tan^2\theta = \sec^2\theta or \sec^2\theta - 1 = \tan^2\theta does the work.

How do you convert back to x after trig substitution?

Draw a right triangle that matches your substitution. For x = a\sin\theta, the opposite side is x, the hypotenuse is a, and the adjacent side is \sqrt{a^2 - x^2} by the Pythagorean theorem. Then read off any trig function of \theta as a ratio of sides.

What if the expression under the root is not in the form a² ± x²?

Complete the square first. For example x^2 + 2x + 5 = (x+1)^2 + 4, so with u = x + 1 the root becomes \sqrt{u^2 + 4} and you can use u = 2\tan\theta.

Is trig substitution the same as u-substitution?

Both change variables, but in opposite directions. In u-substitution you set u equal to a function of x. In trig substitution you set x equal to a function of \theta, which is why you need a triangle to get back to x at the end.

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.