Generalized Integration by Parts

Theorem
Let $f \left({x}\right), g \left({x}\right)$ be real functions which are integrable and at least $n$ times differentiable.

Then:

where $f^{\left({n}\right)}$ denotes the $n$th derivative of $f$.

Proof
Proof by induction:

For all $n \in \N_{> 0}$, let $P \left({n}\right)$ be the proposition:
 * $\displaystyle \int f^{\left({n}\right)} g \ \mathrm d x = \sum_{j \mathop = 0}^{n-1} \left({-1}\right)^j f^{\left({n - j - 1}\right)} g^\left({j}\right) + \left({-1}\right)^n \int f g^{\left({n}\right)} \ \mathrm d x$

Basis for the Induction
$P \left({1}\right)$ is the case:
 * $\displaystyle \int f' g \ \mathrm d x = f g - \int f g' \ \mathrm d x$

which is proved in Integration by Parts.

This is our basis for the induction.

Induction Hypothesis
Now we need to show that, if $P \left({k}\right)$ is true, where $k \ge 1$, then it logically follows that $P \left({k+1}\right)$ is true.

So this is our induction hypothesis:
 * $\displaystyle \int f^{\left({k}\right)} g \ \mathrm d x = \sum_{j \mathop = 0}^{k-1} \left({-1}\right)^j f^{\left({k - j - 1}\right)} g^\left({j}\right) + \left({-1}\right)^k \int f g^{\left({k}\right)} \ \mathrm d x$

Then we need to show:
 * $\displaystyle \int f^{\left({k+1}\right)} g \ \mathrm d x = \sum_{j \mathop = 0}^k \left({-1}\right)^j f^{\left({k - j}\right)} g^\left({j}\right) + \left({-1}\right)^{k + 1} \int f g^{\left({k+1}\right)} \ \mathrm d x$

Induction Step
This is our induction step:

So $P \left({k}\right) \implies P \left({k+1}\right)$ and the result follows by the Principle of Mathematical Induction.

Therefore:
 * $\displaystyle \forall n \in \N_{>0}: \int f^{\left({n}\right)} g \ \mathrm d x = \sum_{j \mathop = 0}^{n-1} \left({-1}\right)^j f^{\left({n - j - 1}\right)} g^\left({j}\right) + \left({-1}\right)^n \int f g^{\left({n}\right)} \ \mathrm d x$

assuming that $f$ and $g$ are sufficiently differentiable.