Non-Elementary Integrals and Special Functions
Sooner or later every calculus student meets an integral that refuses to be solved. Substitution fails, integration by parts goes in circles, and no table has the answer. Often the problem is not your technique. The integral simply cannot be written with the functions you know.
This article explains what that means, which special functions fill the gap, and what to do when you still need a number. If you want to see such a result on screen, you can try any example in the integral calculator. For the general workflow, see How to Solve Integrals Step by Step.
What “Elementary Function” Means
An elementary function is any function built in finitely many steps from:
- constants and x,
- the four arithmetic operations and roots,
- e^x and \ln x,
- trigonometric and inverse trigonometric functions.
Compositions count too. So \sqrt{1+x^2}, e^{\sin x} and \ln(\ln x) are all elementary.
Differentiation never leaves this class: the derivative of an elementary function is elementary. Integration can. An antiderivative always exists for a continuous function, but it may not be elementary. Then we say the integral is non-elementary (informally, “not expressible in closed form” or “non-integrable in elementary terms”).
This is different from “has no antiderivative”. The function
F(x)=\int_0^x e^{-t^2}\,dt
is a perfectly good antiderivative of e^{-x^2}. It just cannot be written using the elementary building blocks above.
Classic Examples
| Integral | Status |
|---|---|
| \int e^{-x^2}\,dx | non-elementary (Gaussian integral) |
| \int \frac{\sin x}{x}\,dx | non-elementary (sine integral) |
| \int \frac{e^x}{x}\,dx | non-elementary (exponential integral) |
| \int \frac{1}{\ln x}\,dx | non-elementary (logarithmic integral) |
| \int x^x\,dx | non-elementary |
| \int \sqrt{1+\cos^2 x}\,dx | non-elementary (elliptic integral) |
Be careful with look-alikes. A small change can make an integral elementary again.
Example 1. Find \int x e^{-x^2}\,dx.
This looks like the Gaussian integral, but the extra factor x is exactly what substitution needs. Let u=-x^2, so du=-2x\,dx and x\,dx=-\tfrac12\,du:
\int x e^{-x^2}\,dx=-\frac12\int e^{u}\,du=-\frac12 e^{u}+C=-\frac12 e^{-x^2}+C.
Check by differentiating:
\frac{d}{dx}\left(-\frac12 e^{-x^2}\right)=-\frac12\cdot(-2x)e^{-x^2}=x e^{-x^2}.
Without the factor x, no substitution works, and this is not a failure of method. If an integral resists substitution and parts, How to Choose an Integration Method helps you decide whether to keep trying or to suspect a non-elementary case.
Why No Formula Exists
The short answer is a theorem. In the 19th century Liouville described exactly what an elementary antiderivative can look like: it must be the original function’s “ingredients” (rational functions, logarithms, exponentials) combined in a restricted way. In 1969 Risch turned this into an algorithm that decides whether an elementary antiderivative exists.
For e^{-x^2}, \frac{\sin x}{x} and the other integrals above, the answer of that test is “no”. We do not prove it here. What matters in practice is the consequence: no amount of cleverness with substitution or parts will produce a closed form.
Special Functions: Giving the Answer a Name
When an integral comes up often enough, mathematicians give its antiderivative a name and tabulate it. These are special functions. Each one is simply defined by an integral.
| Function | Definition | Antiderivative of | Where it appears |
|---|---|---|---|
| Error function \operatorname{erf}(x) | \frac{2}{\sqrt{\pi}}\int_0^x e^{-t^2}\,dt | e^{-x^2} | normal distribution, probability, heat diffusion |
| Sine integral \operatorname{Si}(x) | \int_0^x \frac{\sin t}{t}\,dt | \frac{\sin x}{x} | signal processing, diffraction, Fourier series |
| Exponential integral \operatorname{Ei}(x) | -\int_{-x}^{\infty} \frac{e^{-t}}{t}\,dt (principal value for x>0) | \frac{e^x}{x} | physics, heat conduction, statistics |
| Logarithmic integral \operatorname{li}(x) | \int_0^x \frac{dt}{\ln t} (principal value for x>1) | \frac{1}{\ln x} | number theory, prime counting |
So the results look like this:
\int e^{-x^2}\,dx=\frac{\sqrt{\pi}}{2}\operatorname{erf}(x)+C,
\int \frac{\sin x}{x}\,dx=\operatorname{Si}(x)+C,
\int \frac{e^x}{x}\,dx=\operatorname{Ei}(x)+C \quad (x>0),
\int \frac{dx}{\ln x}=\operatorname{li}(x)+C \quad (x>1).
The constant in the first result comes from the normalization of \operatorname{erf}. Check it by differentiating:
\frac{d}{dx}\left(\frac{\sqrt{\pi}}{2}\operatorname{erf}(x)\right)=\frac{\sqrt{\pi}}{2}\cdot\frac{2}{\sqrt{\pi}}e^{-x^2}=e^{-x^2}.
The functions are related to each other. For example, \operatorname{li}(x)=\operatorname{Ei}(\ln x), which you can verify with the chain rule:
\frac{d}{dx}\operatorname{Ei}(\ln x)=\frac{e^{\ln x}}{\ln x}\cdot\frac{1}{x}=\frac{1}{\ln x}.
Using a special function does not make the integral “solved” in the elementary sense. It means the answer is a well-studied function with known values, graphs and series, and software can evaluate it to any precision.
A Series View
Special functions also have power series, which is how they are often computed. Since
\frac{\sin t}{t}=\sum_{n=0}^{\infty}\frac{(-1)^n t^{2n}}{(2n+1)!},
integrating term by term gives
\operatorname{Si}(x)=\sum_{n=0}^{\infty}\frac{(-1)^n x^{2n+1}}{(2n+1)\,(2n+1)!}=x-\frac{x^3}{18}+\frac{x^5}{600}-\cdots
Near x=0 the first term already gives a good approximation: \operatorname{Si}(x)\approx x.
Definite Integrals: Computing Numbers
A non-elementary antiderivative does not stop you from computing a definite integral. Two routes are available.
Route 1: use the special function. For instance,
\int_0^1 e^{-x^2}\,dx=\frac{\sqrt{\pi}}{2}\operatorname{erf}(1)\approx 0.7468.
Some definite integrals even have exact values, although the antiderivative is non-elementary:
\int_{-\infty}^{\infty} e^{-x^2}\,dx=\sqrt{\pi},\qquad \int_0^{\infty}\frac{\sin x}{x}\,dx=\frac{\pi}{2}.
Route 2: numerical integration. Split [a,b] into small pieces and approximate the area. Simpson’s rule with n subintervals (n even) of width h=\frac{b-a}{n} is
\int_a^b f(x)\,dx\approx\frac{h}{3}\Big[f(x_0)+4f(x_1)+2f(x_2)+\cdots+4f(x_{n-1})+f(x_n)\Big].
Example 2. Estimate \int_0^1 e^{-x^2}\,dx with Simpson’s rule, n=2, h=0.5.
\frac{0.5}{3}\Big[e^{0}+4e^{-0.25}+e^{-1}\Big]\approx\frac{0.5}{3}\big[1+3.1152+0.3679\big]\approx 0.7472.
The exact value is 0.7468\ldots, so two subintervals already give three correct digits. With more subintervals the error shrinks quickly. This is also how you can sanity-check any numerical answer you get from software.
The same idea works for \int_0^1 x^x\,dx, which has no elementary antiderivative at all. It can be written as the series
\int_0^1 x^x\,dx=\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n^n}=1-\frac14+\frac1{27}-\frac1{256}+\cdots\approx 0.7834.
How the Calculator Handles Them
Take the classic case \int \frac{\sin x}{x}\,dx. Enter
sin(x)/x
and the calculator returns the antiderivative as a special function:
\int \frac{\sin x}{x}\,dx=\operatorname{Si}(x)+C.
The solution consists of a single step, labelled the Si rule, followed by the final answer with +C. That is natural here: there are no intermediate manipulations to show, because the answer is the special function itself. As with any integral, the calculator also draws the graph of the result.
Compare this with Example 1. You can check the elementary
look-alike x*exp(-x^2) by hand with substitution, and
the contrast with the Gaussian case is a good exercise in
recognizing which integrals are within reach of elementary
methods.
You can check this step by step in the integral calculator.
Practical Advice
- Try the standard methods first. Many integrals that look hopeless are elementary after a substitution or a trig identity.
- Look for a missing factor. x e^{-x^2} is elementary, e^{-x^2} is not. \sin x \cos x is elementary, \frac{\sin x}{x} is not.
- Recognize the names. If you see e^{-x^2}, \frac{\sin x}{x}, \frac{e^x}{x} or \frac{1}{\ln x} in an indefinite integral, expect \operatorname{erf}, \operatorname{Si}, \operatorname{Ei} or \operatorname{li}.
- For definite integrals, think numerically. A good estimate with a stated error is a legitimate answer.
- Watch geometry problems. Arc length integrals often land in non-elementary territory. The curve y=x^2 gives an elementary integral, but y=\sin x leads to \int\sqrt{1+\cos^2 x}\,dx, an elliptic integral. See Arc Length and Surface Area for the cases that do work out.
Summary
- Elementary functions are built from algebra, e^x, \ln x and trigonometric functions. Their derivatives are elementary, but their antiderivatives may not be.
- Integrals such as \int e^{-x^2}\,dx and \int\frac{\sin x}{x}\,dx have no elementary antiderivative. This is a theorem (Liouville, Risch), not a gap in your technique.
- Special functions \operatorname{erf}, \operatorname{Si}, \operatorname{Ei} and \operatorname{li} give these antiderivatives names, graphs and series.
- Definite integrals of such functions can be computed through the special function, through a series, or numerically, for example with Simpson’s rule.
- Always check whether a similar-looking integral is elementary after all, as with x e^{-x^2}.
For the full process of attacking an integral from the first look to the final check, return to How to Solve Integrals Step by Step.