Integrate by parts twice and solve for the integral

The dreaded calculus torture device that works for exactly two integrals, ${\int e^{ax}\sin bx\,dx}$ and ${\int e^{ax}\cos bx\,dx}$.

Actually, no. A version of it (with one integration by parts) works for ${\int x^n\,dx}$:

$\displaystyle \int x^n\,dx = x^n x - \int x\, d(x^n) = x^{n+1} - n \int x^n\,dx$

hence (assuming ${n\ne -1}$)

$\displaystyle \int x^n\,dx = \frac{x^{n+1}}{n+1} +C$

Yes, this is more of a calculus joke. A more serious example comes from Fourier series.

The functions ${\sin nx}$, ${n=1,2,\dots}$, are orthogonal on ${[0,\pi]}$, in the sense that

$\displaystyle \int_0^\pi \sin nx \sin mx \,dx =0 , \quad m\ne n$

This is usually proved using a trigonometric identity that converts the product to a sum. But the double integration by parts give a nicer proof, because no obscure identities are needed. No boundary terms will appear because the sines vanish at both endpoints:

$\displaystyle \int_0^\pi \sin nx \sin mx \,dx = \frac{n}{m} \int_0^\pi \cos nx \cos mx \,dx = \frac{n^2}{m^2} \int_0^\pi \sin nx \sin mx \,dx$

All integrals here must vanish because ${n^2/m^2\ne 1}$. As a bonus, we get the orthogonality of cosines, ${\int_0^\pi \cos nx \cos mx \,dx=0}$, with no additional effort.

The double integration by parts is also a more conceptual proof, because it gets to the heart of the matter: eigenvectors of a symmetric matrix (operator) that correspond to different eigenvalues are orthogonal. The trigonometric form is incidental, the eigenfunction property is essential. Let’s try this one more time, for the mixed boundary value problem ${f(a)=0}$, ${f'(b)=0}$. Suppose that ${f}$ and ${g}$ satisfy the boundary conditions, ${f''=\lambda f}$, and ${g''=\mu g}$. Since ${fg'}$ and ${f'g}$ vanish at both endpoints, we can pass the primes easily:

$\displaystyle \int_a^b fg= \frac{1}{\mu}\int_a^b fg'' = -\frac{1}{\mu}\int_a^b f'g' = \frac{1}{\mu}\int_a^b f''g = \frac{\lambda}{\mu} \int_a^b fg$

If ${\lambda\ne \mu}$, all integrals must vanish.