Non-Elementary Integrals

Some integrals have no formula at all, and Joseph Liouville proved it. Run his test on a polynomial times e−x², see why the answer hangs on one number, then train on integrands where the right answer may be None exists.

For a polynomial g ∫g(x) e−x2dx=R(x) e−x2+C  ⟺  ∫−∞∞g(x) e−x2dx=0\begin{aligned}\int g(x)\,e^{-x^{2}}dx&=R(x)\,e^{-x^{2}}+C\\ &\iff\int_{-\infty}^{\infty}g(x)\,e^{-x^{2}}dx=0\end{aligned}
The name for the missing formula ∫e−x2dx=π2erf⁡x+C\int e^{-x^{2}}dx=\frac{\sqrt\pi}{2}\operatorname{erf}x+C
Loading interactive simulation...

Lesson

The theory — Non-Elementary Integrals

A function is elementary if it can be built from x and constants by finitely many additions, multiplications, divisions, roots of polynomial equations, exponentials and logarithms; complex values are allowed, which brings in the trigonometric functions and their inverses. An integrand has an elementary antiderivative if some elementary F has F′ = f. Liouville's theorem restricts the form such an F can take, and for f·eg with f and g rational, g not constant, it becomes one test: an elementary antiderivative exists exactly when R′ + g′R = f has a rational solution R, and then R·eg is one.

What each symbol means

R
the rational function Liouville's test looks for; for g(x)e−x² it must be a polynomial
K
g₀ + g₂/2 + 3g₄/4 + 15g₆/8 + …, the multiple of ∫e−x² dx left over after integrating by parts: the whole-line area divided by √π

Where the formula comes from

  1. The form any answer must take. Liouville’s theorem narrows the search to one shape: if ∫g(x)e−x² dx has a formula, it is R(x)e−x² for some polynomial R. Differentiate that and ask it to equal g.
    ∫g(x) e−x2dx=R(x) e−x2 ⇒ g=R′−2xR\int g(x)\,e^{-x^{2}}dx=R(x)\,e^{-x^{2}}\ \Rightarrow\ g=R'-2xR
  2. Match the powers. For a cubic g, R is a quadratic. The x³ and x terms can always be matched. The x² term and the constant term both fix r₁, once as −g₂/2 and once as g₀, and they agree only when g₀ + g₂/2 = 0.
    R=r2x2+r1x+r0:R′−2xR=−2r2x3−2r1x2+(2r2−2r0)x+r1 ⇒ r1=g0=−g22R=r_2x^{2}+r_1x+r_0:\quad R'-2xR=-2r_2x^{3}-2r_1x^{2}+(2r_2-2r_0)x+r_1\ \Rightarrow\ r_1=g_0=-\frac{g_2}{2}
Breaks when
The test on this page covers f·eg with f and g rational, and through x = eu the integrands xm/ln x. Square roots of polynomials need a different argument: Conrad's Example 4.3 explains why ∫dx/√P(x) is not elementary for P of degree 3 or more without repeated roots, and Hardy credits Liouville with the standard elliptic integrals, an ellipse's arc length among them.

Problems solved in full

  1. The elementary neighbour 2 steps

    Find ∫x e−x² dx.

    1. The x is −½ times the derivative of −x², so substitute:

      u=−x2,du=−2x dx,x dx=−12 duu=-x^{2},\quad du=-2x\,dx,\quad x\,dx=-\tfrac12\,du
    2. One exponential:

      ∫x e−x2dx=−12∫eu du=−12e−x2+C\int x\,e^{-x^{2}}dx=-\tfrac12\int e^{u}\,du=-\tfrac12e^{-x^{2}}+C

    Answer

    −½e−x² + C. One factor of x is the whole difference between this integral and ∫e−x² dx, which has no formula at all.

    ∫x e−x2dx=−12e−x2+C\int x\,e^{-x^{2}}dx=-\tfrac12e^{-x^{2}}+C
  2. Four decimals from a series 3 steps

    Evaluate ∫01 e−x² dx to four decimal places.

    Show solution
    1. No antiderivative to use, but e−x² has a power series, and it can be integrated term by term:

      e−x2=∑k≥0(−1)kx2kk! ⇒ ∫01e−x2dx=∑k≥0(−1)kk! (2k+1)e^{-x^{2}}=\sum_{k\ge0}\frac{(-1)^{k}x^{2k}}{k!}\ \Rightarrow\ \int_{0}^{1}e^{-x^{2}}dx=\sum_{k\ge0}\frac{(-1)^{k}}{k!\,(2k+1)}
    2. The terms alternate and shrink, so add them until the next one is too small to matter:

      1−13+110−142+1216−11320+19360=0.746841-\frac13+\frac1{10}-\frac1{42}+\frac1{216}-\frac1{1320}+\frac1{9360}=0{.}74684
    3. For an alternating series the error is smaller than the first term left out:

      ∣R∣<17!⋅15=175600≈1.3×10−5|R|<\frac{1}{7!\cdot15}=\frac{1}{75600}\approx1{.}3\times10^{-5}

    Answer

    0.7468. Stopping one term earlier, at 1/1320, leaves an error bound of 1/9360 ≈ 1.1×10⁻⁴, which cannot vouch for the fourth decimal.

    ∫01e−x2dx≈0.7468\int_{0}^{1}e^{-x^{2}}dx\approx0{.}7468
  3. The same method on sin(x²) 2 steps

    Evaluate ∫01 sin(x²) dx to four decimal places.

    Show solution
    1. sin(x²) has no elementary antiderivative either. Its series, integrated term by term:

      sin⁡x2=∑k≥0(−1)kx4k+2(2k+1)! ⇒ ∫01sin⁡x2 dx=∑k≥0(−1)k(2k+1)! (4k+3)\sin x^{2}=\sum_{k\ge0}\frac{(-1)^{k}x^{4k+2}}{(2k+1)!}\ \Rightarrow\ \int_{0}^{1}\sin x^{2}\,dx=\sum_{k\ge0}\frac{(-1)^{k}}{(2k+1)!\,(4k+3)}
    2. Three terms, and the fourth bounds the error:

      13−142+11320=0.31028,∣R∣<175600\frac13-\frac1{42}+\frac1{1320}=0{.}31028,\qquad |R|<\frac{1}{75600}

    Answer

    0.3103. This is a Fresnel integral: Augustin Fresnel needed it in 1818 for his theory of the diffraction of light.

    ∫01sin⁡x2 dx≈0.3103\int_{0}^{1}\sin x^{2}\,dx\approx0{.}3103
  4. Parts, down to the integral that has no formula 3 steps

    Find ∫x² e−x² dx, and its value from 0 to ∞, given ∫0∞ e−x² dx = √π/2.

    Show solution
    1. Split x² e−x² as x · x e−x²; the second factor has the antiderivative of the first problem:

      u=x,dv=x e−x2dx,v=−12e−x2u=x,\quad dv=x\,e^{-x^{2}}dx,\quad v=-\tfrac12e^{-x^{2}}
    2. One round of parts leaves ∫e−x² dx, which has no formula, so it stays as it is:

      ∫x2e−x2dx=−12x e−x2+12∫e−x2dx\int x^{2}e^{-x^{2}}dx=-\tfrac12x\,e^{-x^{2}}+\tfrac12\int e^{-x^{2}}dx
    3. Over [0, ∞) the boundary term is 0 at both ends and the integral left is known:

      ∫0∞x2e−x2dx=[−12x e−x2]0∞+12⋅π2=π4\int_{0}^{\infty}x^{2}e^{-x^{2}}dx=\Bigl[-\tfrac12x\,e^{-x^{2}}\Bigr]_{0}^{\infty}+\tfrac12\cdot\frac{\sqrt\pi}{2}=\frac{\sqrt\pi}{4}

    Answer

    −½x e−x² + (√π/4) erf x + C, and √π/4 ≈ 0.4431 over [0, ∞). erf is the name given to the integral that has no formula, scaled so that it tends to 1.

    ∫x2e−x2dx=−12x e−x2+π4erf⁡x+C,∫0∞x2e−x2dx=π4≈0.4431\int x^{2}e^{-x^{2}}dx=-\tfrac12x\,e^{-x^{2}}+\frac{\sqrt\pi}{4}\operatorname{erf}x+C,\qquad \int_{0}^{\infty}x^{2}e^{-x^{2}}dx=\frac{\sqrt\pi}{4}\approx0{.}4431
  5. Two pieces without formulas that add up to one 1 steps

    Find ∫ex(1/x − 1/x²) dx for x > 0.

    Show solution
    1. Neither ∫eˣ/x dx nor ∫eˣ/x² dx is elementary. But differentiate eˣ/x by the quotient rule:

      ddx exx=exx−exx2=ex(1x−1x2)\frac{d}{dx}\,\frac{e^{x}}{x}=\frac{e^{x}x-e^{x}}{x^{2}}=e^{x}\left(\frac1x-\frac1{x^{2}}\right)

    Answer

    eˣ/x + C. Liouville’s theorem is about the whole integrand: a sum can have a formula when neither of its terms does.

    ∫ex(1x−1x2)dx=exx+C\int e^{x}\left(\frac1x-\frac1{x^{2}}\right)dx=\frac{e^{x}}{x}+C
  6. Which c makes (4x⁴ + c)e^(−x²) integrable? 4 steps

    For which c does (4x⁴ + c)e−x² have an elementary antiderivative, and what is it? The page's boxes stop at x³. Press Balanced for the same question one degree lower.

    Open this problem in the tool

    Show solution
    1. Integrating by parts, each x2m leaves (2m − 1)!!/2m times ∫e−x² dx behind; for x⁴ that weight is 3/4. Add up the leftovers:

      K=c+4⋅3⋅122=c+3K=c+4\cdot\frac{3\cdot1}{2^2}=c+3
    2. A formula needs the leftover to vanish:

      K=0 ⇒ c=−3K=0\ \Rightarrow\ c=-3
    3. Then R has degree 3. Matching powers of R′ − 2xR = 4x⁴ − 3 from the top down:

      −2r3=4,  −2r2=0,  3r3−2r1=0,  2r2−2r0=0 ⇒ R=−2x3−3x;r1=−3=g0-2r_3=4,\ \ -2r_2=0,\ \ 3r_3-2r_1=0,\ \ 2r_2-2r_0=0\ \Rightarrow\ R=-2x^3-3x;\qquad r_1=-3=g_0
    4. Check by differentiating:

      ddx(−(2x3+3x)e−x2)=(−6x2−3+4x4+6x2)e−x2=(4x4−3)e−x2\frac{d}{dx}\Big(-(2x^3+3x)e^{-x^2}\Big)=\big(-6x^2-3+4x^4+6x^2\big)e^{-x^2}=\left(4x^4-3\right)e^{-x^2}

    Answer

    c = −3, and ∫(4x⁴ − 3)e−x² dx = −(2x³ + 3x)e−x² + C. Any other c leaves (c + 3)∫e−x² dx behind, which has no formula, and the whole-line area is then (c + 3)√π instead of zero.

    c=−3:∫(4x4−3)e−x2 dx=−(2x3+3x)e−x2+Cc=-3:\quad\int\left(4x^4-3\right)e^{-x^2}\,dx=-\left(2x^3+3x\right)e^{-x^2}+C

Supplementary problems, answers only

  1. Find ∫ x³e−x² dx, or show that it has no formula.

    Show answer

    −½(x² + 1)e−x² + C. An odd power of x in front makes it elementary: u = x², then parts.

    −12(x2+1)e−x2+C-\tfrac12\left(x^{2}+1\right)e^{-x^{2}}+C
  2. Use the series for sin x to find ∫01 (sin x)/x dx to four decimals.

    Show answer

    0.9461, from 1 − 1/18 + 1/600 − 1/35280. The next term, 1/3265920, cannot change the fourth decimal.

    1−118+1600−135280≈0.94611-\tfrac1{18}+\tfrac1{600}-\tfrac1{35280}\approx0{.}9461
  3. Write ∫02 e−x² dx with erf, and give its value.

    Show answer

    (√π/2) erf 2 ≈ 0.8821.

    ∫02e−x2 dx=π2erf⁡2≈0.8821\int_{0}^{2}e^{-x^{2}}\,dx=\tfrac{\sqrt\pi}{2}\operatorname{erf}2\approx0{.}8821

“No formula” for e⁻ˣ² is a theorem

Press The bell curve. The trainer asks for ∫3e−x² dx, and the right answer is None exists. Nobody is waiting for a cleverer substitution: Joseph Liouville proved in the 1830s that no combination of powers, roots, exponentials, logarithms and trigonometric functions, however long, has e−x² as its derivative. Given Liouville's theorem, the last step fits in a paragraph, and Brian Conrad's notes give it: if an elementary antiderivative existed, one would have the form R(x)e−x² with R a rational function, so R′ − 2xR = 1. A polynomial R makes the left side's degree too high; a pole of R gives R′ a pole of one order more, which nothing on either side cancels. And yet the antiderivative exists. The lower panel draws it from Simpson's rule, a smooth rising curve, and the results print ∫₀¹ 3e−x² dx = 2.2405. What is missing is a formula, not a function, and mathematicians named a scaled copy of it: the error function erf(x) = (2/√π)∫₀ˣ e−t² dt, so the trainer’s antiderivative is (3√π/2)·erf(x) + C. Press 1/ln x: the same theorem, through x = eu, rules out a formula for the logarithmic integral ∫dx/ln x, and the page draws that antiderivative just the same.

Times a polynomial, e⁻ˣ² has a formula exactly when its area over the whole line is zero

Liouville's test can be run, not just quoted. Type a cubic g into the boxes and step through it: any formula for ∫g(x)e−x² dx would have to be R(x)e−x² with R a polynomial, so R′ − 2xR must equal g, and matching powers from the top down either finds R or ends in a contradiction at the constant term. Press x²·e⁻ˣ². The steps force R = −½x and then ask −½ to equal 0, so there is no formula, and the area over the whole line is √π/2 = 0.8862. Press Balanced, (2x² − 1)e−x²: the steps find R = −x, so the integral is −xe−x² + C, and the area is 0.0000. The two facts are one fact. A formula R(x)e−x² dies away at both ends, so the area between them, F(∞) − F(−∞), is zero; and integrating by parts reduces every x2me−x² to a formula plus a fixed multiple of ∫e−x² dx, a multiple that adds up to the area divided by √π. In numbers: a formula exists exactly when g₀ + g₂/2 = 0, and the odd powers never matter. The green and red shading make it visible: they must cancel.

Count the integrands in a family and those with a formula all but vanish

Liouville's theorem is about the integrand in front of you. It does not say what fraction of integrals have no formula, and cannot, because “most” needs a family and a way of counting. So count a family. Take every cubic g with integer coefficients from −3 to 3, 2,401 of them. Times e−x², 147 have an elementary antiderivative, 6.12%, and they are exactly the ones with g₂ = −2g₀: three lit cells of the 49 in the grid, with g₁ and g₃ free. Widen the coefficients to −10 … 10 and the share drops to 2.49%; to −100 … 100, 0.25%; each tenfold widening divides it by about ten, as the table shows. A formula needs one exact coincidence among the coefficients, and an exact coincidence is a line drawn through a square that keeps growing. The trainer gives you a formula about half the time only because it was built to; drawn at random from this family, almost no integrand would have one.

Learning path

Techniques of integration

References (2)
Further reading (1)