BetaFree coursewareRewritten from MIT OpenCourseWareCC BY-NC-SA 4.0
Open CosmologyPhysics & cosmology, from high school to a graduate year

Inverse substitution and completing the square

Secants and tangents: their derivatives, the integrals of tan x and sec x, and powers of sec x. Then the three trigonometric substitutions that remove a square root: x = a sin θ for √(a² − x²), x = a tan θ for √(a² + x²), x = a sec θ for √(x² − a²). A right triangle undoes the substitution at the end. When the quadratic under the root has a middle term, completing the square brings it to one of these forms.

You need this first

Full reading path (16 pages)
  1. The derivative: slope of the tangent line and rate of change (18.01)
  2. Limits and continuity (18.01)
  3. Derivatives of sine and cosine, and the product and quotient rules (18.01)
  4. The chain rule and higher derivatives (18.01)
  5. Implicit differentiation and the derivatives of inverse functions (18.01)
  6. Exponentials and logarithms: the number e and its derivatives (18.01)
  7. Linear and quadratic approximations (18.01)
  8. Curve sketching with the first and second derivative (18.01)
  9. Sketching strategy and maximum–minimum problems (18.01)
  10. More max–min, and related rates (18.01)
  11. A ring on a string, and Newton's method (18.01)
  12. The mean value theorem and inequalities (18.01)
  13. Differentials and antiderivatives (18.01)
  14. Definite integrals and Riemann sums (18.01)
  15. The first fundamental theorem of calculus (18.01)
  16. Trigonometric integrals and substitution (18.01)
On this page · 6 sections
  1. Secants and tangents
  2. A trigonometric substitution
  3. Undoing the substitution with a triangle
  4. The three substitutions
  5. Completing the square
  6. Summary

The second of two lectures by the substitute lecturer, and in his words maybe the most technical part of the course (transcript, p. 1). It finishes the trigonometric integrals with secants and tangents, then uses trigonometric identities to integrate square roots of quadratics.

Secants and tangents#

The secant is 1/cos⁡x1/\cos x, the cosecant 1/sin⁡x1/\sin x, the tangent sin⁡x/cos⁡x\sin x/\cos x and the cotangent cos⁡x/sin⁡x\cos x/\sin x: putting "co" in front exchanges sine and cosine (transcript, p. 1). Dividing cos⁡2x+sin⁡2x=1\cos^2 x + \sin^2 x = 1 by cos⁡2x\cos^2 x gives the identity behind this lecture, sec⁡2x=1+tan⁡2x\sec^2 x = 1 + \tan^2 x (p. 1). The quotient rule gives the derivatives (pp. 1–2):

Derivatives of tangent and secant
ddxtan⁡x=cos⁡2x+sin⁡2xcos⁡2x=sec⁡2x,ddxsec⁡x=sin⁡xcos⁡2x=sec⁡xtan⁡x\frac{d}{dx}\tan x = \frac{\cos^2 x + \sin^2 x}{\cos^2 x} = \sec^2 x, \qquad \frac{d}{dx}\sec x = \frac{\sin x}{\cos^2 x} = \sec x\tan x
In words

d over d x tan x equals the quantity cos squared x plus sine squared x, all over the quantity cos squared x, equals secant squared x, d over d x secant x equals sine x over the quantity cos squared x, equals secant x tan x

Source: 18.01 Lecture 28 transcript, pp. 1–2

so ∫sec⁡2x dx=tan⁡x+c\int\sec^2 x\,dx = \tan x + c and ∫sec⁡xtan⁡x dx=sec⁡x+c\int\sec x\tan x\,dx = \sec x + c (p. 2). With u=cos⁡xu = \cos x, ∫tan⁡x dx=−ln⁡∣cos⁡x∣+c\int\tan x\,dx = -\ln|\cos x| + c (p. 2), as in the previous lecture.

For the secant the lecture uses a different trick from the one in the previous lecture's notes. Add the two derivatives: (sec⁡x+tan⁡x)′=sec⁡2x+sec⁡xtan⁡x=sec⁡x (sec⁡x+tan⁡x)(\sec x + \tan x)' = \sec^2 x + \sec x\tan x = \sec x\,(\sec x + \tan x). Call u=sec⁡x+tan⁡xu = \sec x + \tan x; then u′=usec⁡xu' = u\sec x, so sec⁡x=u′/u\sec x = u'/u, the logarithmic derivative of uu (p. 3):

Integral of the secant
sec⁡x=u′u=ddxln⁡u⇒∫sec⁡x dx=ln⁡∣sec⁡x+tan⁡x∣+c\sec x = \frac{u'}{u} = \frac{d}{dx}\ln u \quad\Rightarrow\quad \int \sec x\,dx = \ln|\sec x + \tan x| + c
In words

secant x equals u prime over u equals d over d x log u which gives the integral of secant x d x equals log the absolute value of secant x plus tan x plus c

(The lecture and the notes write ln⁡(sec⁡x+tan⁡x)\ln(\sec x + \tan x); the absolute value is needed where sec⁡x+tan⁡x<0\sec x + \tan x < 0.) With these, most trigonometric polynomials can be integrated (p. 3). For example, replace two of four secants with 1+tan⁡2x1 + \tan^2 x and substitute u=tan⁡xu = \tan x, du=sec⁡2x dxdu = \sec^2 x\,dx (pp. 3–4):

Fourth power of the secant
∫sec⁡4x dx=∫(1+tan⁡2x)sec⁡2x dx=∫(1+u2) du=tan⁡x+tan⁡3x3+c\int \sec^4 x\,dx = \int (1 + \tan^2 x)\sec^2 x\,dx = \int (1 + u^2)\,du = \tan x + \frac{\tan^3 x}{3} + c
In words

the integral of secant to the power 4 x d x equals the integral of the quantity 1 plus tan squared x, secant squared x d x equals the integral of the quantity 1 plus u squared, d u equals tan x plus tan cubed x over 3 plus c

A trigonometric substitution#

Now a hard-looking integral, ∫dxx21+x2\int\frac{dx}{x^2\sqrt{1 + x^2}} (transcript, p. 4). The square root is the ugly part. The identity 1+tan⁡2θ=sec⁡2θ1 + \tan^2\theta = \sec^2\theta writes 1+x21 + x^2 as a square if x=tan⁡θx = \tan\theta: then 1+x2=sec⁡θ\sqrt{1 + x^2} = \sec\theta and dx=sec⁡2θ dθdx = \sec^2\theta\,d\theta (p. 4). This is an inverse substitution: instead of naming a piece of the integrand uu, we write xx itself as a function of a new variable. Substituting, cancelling, and writing everything in sines and cosines (pp. 4–5):

After the substitution x=tan⁡θx = \tan\theta
∫sec⁡2θ dθtan⁡2θ sec⁡θ=∫sec⁡θtan⁡2θ dθ=∫cos⁡θsin⁡2θ dθ\int \frac{\sec^2\theta\,d\theta}{\tan^2\theta\,\sec\theta} = \int \frac{\sec\theta}{\tan^2\theta}\,d\theta = \int \frac{\cos\theta}{\sin^2\theta}\,d\theta
In words

the integral of secant squared theta d theta over the quantity tan squared theta secant theta, equals the integral of secant theta over the quantity tan squared theta, times d theta equals the integral of cos theta over the quantity sine squared theta, times d theta

Rewriting in sines and cosines is the systematic move when it is not clear how a mix of trig functions will simplify (p. 5). Now u=sin⁡θu = \sin\theta, du=cos⁡θ dθdu = \cos\theta\,d\theta gives ∫u−2 du=−1/u+c=−1sin⁡θ+c\int u^{-2}\,du = -1/u + c = -\frac{1}{\sin\theta} + c, minus the cosecant (pp. 5–6). Choose u=sin⁡θu = \sin\theta rather than cos⁡θ\cos\theta because then dudu appears in the numerator (p. 5).

Undoing the substitution with a triangle#

The answer is in terms of θ\theta, but x=tan⁡θx = \tan\theta. Draw a right triangle with angle θ\theta and choose the sides to make that true: opposite xx, adjacent 1, so the hypotenuse is 1+x2\sqrt{1 + x^2} (transcript, p. 6). Then 1/sin⁡θ1/\sin\theta, the cosecant, is hypotenuse over opposite (pp. 6–7):

Result
∫dxx21+x2=−1sin⁡θ+c=−1+x2x+c\int \frac{dx}{x^2\sqrt{1 + x^2}} = -\frac{1}{\sin\theta} + c = -\frac{\sqrt{1 + x^2}}{x} + c
In words

the integral of d x over the quantity x squared the square root of 1 plus x squared, end of root, equals minus 1 over the quantity sine theta, plus c equals minus the square root of 1 plus x squared, end of root, over x plus c

Writing minus the cosecant of tan⁡−1x\tan^{-1}x would also be correct, but the triangle gives a far more useful answer (pp. 7–8). (On p. 7 the transcript says "cosine" and "arctan of theta" where it means minus the cosecant of tan⁡−1x\tan^{-1}x.) The same trick evaluates any trig function of an inverse trig function. For the tangent of the angle whose cosecant is xx (the arccosecant): take θ\theta with 1/sin⁡θ=x1/\sin\theta = x, so hypotenuse over opposite is xx; choose opposite 1 and hypotenuse xx, so the adjacent side is x2−1\sqrt{x^2 - 1} and tan⁡θ=1/x2−1\tan\theta = 1/\sqrt{x^2 - 1} (p. 8).

The three substitutions#

Each identity removes one kind of root (transcript, pp. 8–9; notes, p. 3):

Trigonometric substitutions
a2−x2:  x=asin⁡θ  ⇒  acos⁡θ;a2+x2:  x=atan⁡θ  ⇒  asec⁡θ;x2−a2:  x=asec⁡θ  ⇒  atan⁡θ\sqrt{a^2 - x^2}:\; x = a\sin\theta \;\Rightarrow\; a\cos\theta; \qquad \sqrt{a^2 + x^2}:\; x = a\tan\theta \;\Rightarrow\; a\sec\theta; \qquad \sqrt{x^2 - a^2}:\; x = a\sec\theta \;\Rightarrow\; a\tan\theta
In words

the square root of a squared minus x squared, end of root, : x equals a sine theta which gives a cos theta; the square root of a squared plus x squared, end of root, : x equals a tan theta which gives a secant theta; the square root of x squared minus a squared, end of root, : x equals a secant theta which gives a tan theta

Source: 18.01 Lecture 28 transcript, pp. 8–9

For the first, x=acos⁡θx = a\cos\theta works equally well and gives asin⁡θa\sin\theta (p. 8). This is how the previous lecture found the area of a piece of a disk, which the notes complete with the triangle trick: ∫0xa2−t2 dt=a22sin⁡−1xa+x2a2−x2\int_0^x\sqrt{a^2 - t^2}\,dt = \frac{a^2}{2}\sin^{-1}\frac{x}{a} + \frac{x}{2}\sqrt{a^2 - x^2}, a sector plus a triangle (notes, pp. 1–3). The notes remark that when the answer is this complicated, the route to it cannot be simple (p. 2).

Completing the square#

Not every root of a quadratic has one of these forms: there may be a middle term (transcript, p. 9). Complete the square: write the quadratic as a square plus or minus a constant. For x2+4xx^2 + 4x, the middle term 2ax2ax forces a=2a = 2, and (x+2)2=x2+4x+4(x + 2)^2 = x^2 + 4x + 4, so (pp. 9–10; notes, p. 3):

Completing the square
x2+4x=(x+2)2−4x^2 + 4x = (x + 2)^2 - 4
In words

x squared plus 4 x equals the quantity x plus 2, all squared minus 4

Source: 18.01 Lecture 28 transcript, pp. 9–10

Substitute u=x+2u = x + 2, du=dxdu = dx, to get ∫duu2−4\int\frac{du}{\sqrt{u^2 - 4}}, the third form with a=2a = 2. So u=2sec⁡θu = 2\sec\theta, du=2sec⁡θtan⁡θ dθdu = 2\sec\theta\tan\theta\,d\theta and u2−4=2tan⁡θ\sqrt{u^2 - 4} = 2\tan\theta; everything cancels except ∫sec⁡θ dθ\int\sec\theta\,d\theta (pp. 10–11). Then sec⁡θ=u/2\sec\theta = u/2 and tan⁡θ=u2−4/2\tan\theta = \sqrt{u^2 - 4}/2 (p. 11), and the constant −ln⁡2-\ln 2 can be absorbed (notes, p. 4):

Result after completing the square
∫dxx2+4x=ln⁡(x+22+x2+4x2)+c=ln⁡(x+2+x2+4x)+c~\int \frac{dx}{\sqrt{x^2 + 4x}} = \ln\left(\frac{x + 2}{2} + \frac{\sqrt{x^2 + 4x}}{2}\right) + c = \ln\left(x + 2 + \sqrt{x^2 + 4x}\right) + \tilde c
In words

the integral of d x over the square root of x squared plus 4 x, end of root, equals log of the quantity the quantity x plus 2, all over 2 plus the square root of x squared plus 4 x, end of root, over 2, plus c equals log of the quantity x plus 2 plus the square root of x squared plus 4 x, end of root, plus c tilde

(For x>0x > 0; for x<−4x < -4 the logarithm needs an absolute value.) The notes end with a preview: next comes integrating any ratio of polynomials, by partial fractions (notes, pp. 4–5).

Worked example

Three square roots

Find (a) ∫dxx24+x2\int\frac{dx}{x^2\sqrt{4 + x^2}}, (b) ∫01dx1+x2\int_0^1\frac{dx}{\sqrt{1 + x^2}}, (c) ∫dxx2−6x+5\int\frac{dx}{\sqrt{x^2 - 6x + 5}} for x>5x > 5.

(a) x=2tan⁡θx = 2\tan\theta

dx=2sec⁡2θ dθdx = 2\sec^2\theta\,d\theta and 4+x2=2sec⁡θ\sqrt{4 + x^2} = 2\sec\theta, so the integral is ∫2sec⁡2θ dθ4tan⁡2θ⋅2sec⁡θ=14∫cos⁡θsin⁡2θ dθ=−14sin⁡θ+c\int\frac{2\sec^2\theta\,d\theta}{4\tan^2\theta\cdot 2\sec\theta} = \frac{1}{4}\int\frac{\cos\theta}{\sin^2\theta}\,d\theta = -\frac{1}{4\sin\theta} + c. The triangle has opposite xx, adjacent 2, hypotenuse 4+x2\sqrt{4 + x^2}, so the answer is −4+x24x+c-\frac{\sqrt{4 + x^2}}{4x} + c.

(b) x=tan⁡θx = \tan\theta

The integrand becomes sec⁡θ dθ\sec\theta\,d\theta, and xx from 0 to 1 means θ\theta from 0 to π/4\pi/4: ln⁡(sec⁡θ+tan⁡θ)\ln(\sec\theta + \tan\theta) at π/4\pi/4 is ln⁡(2+1)≈0.881\ln(\sqrt 2 + 1) \approx 0.881, and at 0 it is ln⁡1=0\ln 1 = 0. So the integral is about 0.881.

(c) Complete the square

x2−6x+5=(x−3)2−4x^2 - 6x + 5 = (x - 3)^2 - 4. With u=x−3=2sec⁡θu = x - 3 = 2\sec\theta this is the integral just done: ln⁡(x−3+x2−6x+5)+c\ln\left(x - 3 + \sqrt{x^2 - 6x + 5}\right) + c. Check by differentiating: the derivative of the inside is 1+x−3x2−6x+51 + \frac{x - 3}{\sqrt{x^2 - 6x + 5}}, which divided by the inside is 1x2−6x+5\frac{1}{\sqrt{x^2 - 6x + 5}}.

Summary#

  • sec⁡2x=1+tan⁡2x\sec^2 x = 1 + \tan^2 x; (tan⁡x)′=sec⁡2x(\tan x)' = \sec^2 x, (sec⁡x)′=sec⁡xtan⁡x(\sec x)' = \sec x\tan x; ∫sec⁡x dx=ln⁡∣sec⁡x+tan⁡x∣+c\int\sec x\,dx = \ln|\sec x + \tan x| + c.
  • Trigonometric substitutions: a2−x2\sqrt{a^2 - x^2} with x=asin⁡θx = a\sin\theta, a2+x2\sqrt{a^2 + x^2} with x=atan⁡θx = a\tan\theta, x2−a2\sqrt{x^2 - a^2} with x=asec⁡θx = a\sec\theta.
  • Undo the substitution with a right triangle whose sides make it true.
  • A quadratic with a middle term: complete the square, shift the variable, then substitute.

Symbols on this page

Show the 26 symbols used here
θ\theta theta.
The new angle variable in a trigonometric substitution (x = a sin θ, a tan θ or a sec θ). Say it: “theta” (sounds like “thay-ta or thee-ta”).
π\pi pi.
The ratio of a circle's circumference to its diameter, π ≈ 3.14159. Say it: “pi”.
Ω\Omega capital omega.
The density parameter Ω = ρ/ρ_c. Subscripts pick one ingredient: Ω_m matter, Ω_vac (or Ω_Λ) vacuum energy, Ω_r radiation, Ω_k curvature. Say it: “capital omega”.
≈\approx approximately equal.
Is approximately equal to. Say it: “is approximately”.
⇒\Rightarrow implies.
Implies: what follows is a consequence of what came before. Say it: “which gives”.
⋅\cdot dot.
Times (multiplication). Between two vectors: the dot product. Say it: “times”.
∫\int integral.
Integral: the sum of infinitely many small pieces, such as the area under a curve. Say it: “the integral of”.
sin⁡\sin sine.
Sine of an angle. Say it: “sine”.
cos⁡\cos cosine.
Cosine of an angle. Say it: “cos”.
tan⁡\tan tangent.
Tangent of an angle, sin/cos. Say it: “tan”.
ln⁡\ln natural logarithm.
Natural logarithm (base e ≈ 2.718). Say it: “log”.
a~\tilde a tilde.
A modified version of a quantity (ã, k̃); its meaning is given where it is introduced. Say it: “tilde”.
aa a.
The positive constant in √(a² − x²), √(a² + x²) and √(x² − a²); in completing the square, half the coefficient of the middle term. Say it: “a”.
cc c.
The constant of integration; in x² + bx + c, the constant term. Say it: “c”.
H0H_{0} Hubble constant.
The Hubble constant: today's value of H, about 67–73 km/s/Mpc. Unit: 1/s (usually km/s/Mpc). Say it: “H nought”.
Ωm\Omega_{m} matter density parameter.
The matter density as a fraction of the critical density, ρ_m/ρ_c; ',0' means today (about 0.3). Say it: “capital omega m”.
Ωvac\Omega_{\text{vac}} vacuum density parameter.
The vacuum-energy density as a fraction of the critical density; ',0' means today (about 0.7). Say it: “capital omega vac”.
xx x.
The variable of integration; in the cosmology note, the scale factor (normalised to 1 today). Say it: “x”.
tt t.
A dummy variable of integration. Say it: “t”.
dd d.
As in dx, du and dθ: a differential. Say it: “d”.
bb b.
The coefficient of the middle term in x² + bx + c. Say it: “b”.
uu u.
The new variable in a substitution (sec x + tan x, tan x, sin θ, x + 2, or x′^(3/2) in the cosmology note). Say it: “u”.
ww w.
In the cosmology note, √(Ω_vac,0/Ω_m,0) x^(3/2), the variable in the final logarithm. Say it: “w”.
x′x' x prime.
In the cosmology note, the scale factor used as the variable of integration. Say it: “x prime”.
u′u' u prime.
The derivative of u = sec x + tan x. Say it: “u prime”.
sec⁡\sec secant.
The secant, sec x = 1/cos x. Say it: “secant”.

Tap or click a symbol in a formula to see the same explanation. All symbols: symbols and notation.

Words on this page

Show the 22 words used here

New here

inverse substitution.
A change of variable that writes x in terms of a new variable, such as x = sin θ, often to remove a square root.
completing the square.
Rewriting x² + bx + c as (x + b/2)² plus a number, which turns any quadratic into a shifted square.

Also used

p..
Page, in a reference to a source; pp. means pages, as in pp. 3–5.
integral.
A sum of very many very small pieces, such as the area under a graph; it undoes taking a derivative. Explained in Rates of change and area under a graph.
secant.
The trigonometric function sec x, equal to 1 divided by cos x.
tangent.
The trigonometric function tan x, equal to sin x divided by cos x.
integration.
Finding an integral: adding up very many small pieces, or finding an antiderivative. Explained in Differentials and antiderivatives.
quotient rule.
The rule for the derivative of a fraction of two functions: (u/v)′ = (u′v − uv′)/v².
derivative.
The rate at which a function changes as its input changes: the slope of its graph at a point. Explained in Position and velocity in one dimension.
logarithmic derivative.
The derivative of ln f, equal to f′/f: the rate of change of a quantity as a fraction of its size. Explained in Exponentials and logarithms: the number e and its derivatives.
integrand.
The function being integrated: the f(x) in ∫ f(x) dx. Explained in The logarithm from an integral, and areas between curves.
inverse.
The thing that undoes another: a matrix times its inverse gives the identity matrix, as a function followed by its inverse gives back the start. Explained in Planes through three points, and matrices.
logarithm.
The power to which a fixed base must be raised to give a number: log₁₀ 1000 = 3 because 10³ = 1000. Explained in Exponentials and logarithms.
partial fractions.
Splitting a fraction of polynomials into a sum of simpler fractions, each easy to integrate. Explained in Partial fractions.
differentiation.
Finding a derivative: working out how fast a function changes. Explained in The derivative: slope of the tangent line and rate of change.
flat universe.
A universe with exactly the critical density, whose space has no curvature and which expands forever, ever more slowly. Explained in Open, closed and flat universes.
vacuum energy.
Energy that empty space itself carries, the same everywhere and unchanged as the universe expands. Explained in Dark energy and the accelerating universe.
scale factor.
The number a(t) that tells how much distances in the universe have stretched: when it doubles, every distance between galaxies doubles. Explained in Towards the universe: an expanding gas cools.
hyperbolic functions.
Cousins of sine and cosine built from exponentials: sinh x = (eˣ − e⁻ˣ)/2, cosh x = (eˣ + e⁻ˣ)/2, and their ratios.
trigonometric substitution.
A method of solving an integral by replacing the variable with a sine, cosine or similar function so that a square root simplifies. Explained in The closed universe as a cycloid.

Academic

transcript.
A written record of exactly what was said in a recorded lecture, word for word.
systematic.
Following a fixed method; of an error, one that pushes every result the same way, so averaging does not remove it.

Tap or click a word, here or in the text, for its meaning in this lesson. All words: the glossary. How many words are marked in the text: Reading options (the “Aa” button).

Where this leads

In cosmology

Pages that build on this

Practise

Check your understanding

  1. Which substitution removes the root in ∫dx9+x2\int \frac{dx}{\sqrt{9 + x^2}}?
  2. If x=tan⁡θx = \tan\theta (with 0<θ<π/20 < \theta < \pi/2), then cos⁡θ=\cos\theta =
  3. Completing the square, x2−6x+5=x^2 - 6x + 5 =
  4. ∫01dx1+x2=\int_0^1 \frac{dx}{\sqrt{1 + x^2}} =
0 of 4 answered

Flashcards

1 / 4