Math
Check an integral by differentiating it: a method with examples from the NIST DLMF
A method to check an integral: differentiate your result and compare it with the original function. Examples from the DLMF: the integrals of sin, cos, tan and ln, with common mistakes such as a forgotten constant or ignored domain.
Last reviewed:
The idea in one line
Integration and differentiation are inverse operations. If F is an integral of f, the derivative of F must equal f. So you solve it yourself, then differentiate your result and compare. This checks your understanding. It does not replace the solving.
Reference results we read in the DLMF
- ∫ sin x dx = -cos x (section 4.26)
- ∫ cos x dx = sin x (section 4.26)
- ∫ tan x dx = -ln(cos x), for -π/2 < x < π/2 (section 4.26)
- ∫ dz/z = ln z (section 4.10)
- ∫ ln z dz = z ln z - z (section 4.10)
- ∫ z^n ln z dz = z^(n+1) ln z/(n+1) - z^(n+1)/(n+1)^2 when n ≠ -1 (section 4.10)
A worked check
- We want to check that F(x) = x ln x - x is an integral of f(x) = ln x.
- Differentiate the first term with the product rule: (x ln x)' = ln x + x · (1/x) = ln x + 1.
- Differentiate the second term: (-x)' = -1.
- Add: ln x + 1 - 1 = ln x, the original function, so the result is right.
- Optional numeric check: at x = 2 a small central difference of F gives a value very close to ln 2 ≈ 0.6931.
Common mistakes
- Forgetting the +C in an indefinite integral.
- Ignoring the domain: the tan x formula above holds on the interval from -π/2 to π/2 only.
- Mixing up the sign for sin x: the result is -cos x, not cos x.
- Using the ln z result at negative values without checking the domain, since the DLMF defines the logarithm by its principal branch.
- Comparing at a single point only. Try several points inside the domain.
A simple numeric comparison
Pick several points x inside the domain, compute the central difference (F(x+h) - F(x-h)) / (2h) with a small h such as 0.000001, and compare it with f(x). If the numbers agree to several digits at every point, your result is acceptable. Stay away from points where the function is discontinuous. For helper arithmetic the site has the units and percentage tools, and we will add a comparison tool once the tools component exists.
Limits of this page
We read only sections 4.10 and 4.26 and cite only what is in them. The numeric check is our own calculation on the listed formulas. Harder integrals need other pages.
Related pages
Sources
Wording is ours, from the official source. Images and video belong to their owners and are credited with a link to the official page.