Generalized Integration by Parts

Theorem
Let $\map f x, \map g x$ be real functions which are integrable and at least $n$ times differentiable.

Then:

where $f^{\paren n}$ 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^{\paren n} g \rd x = \sum_{j \mathop = 0}^{n - 1} \paren {-1}^j f^{\paren {n - j - 1} } g^\paren j + \paren {-1}^n \int f g^{\paren n} \rd x$

Basis for the Induction
$\map P 1$ is the case:
 * $\displaystyle \int f' g \rd x = f g - \int f g' \rd x$

which is proved in Integration by Parts.

This is our basis for the induction.

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

So this is our induction hypothesis:
 * $\displaystyle \int f^{\paren k} g \rd x = \sum_{j \mathop = 0}^{k - 1} \paren {-1}^j f^{\paren {k - j - 1} } g^{\paren j} + \paren {-1}^k \int f g^{\paren k} \rd x$

Then we need to show:
 * $\displaystyle \int f^{\paren {k + 1} } g \rd x = \sum_{j \mathop = 0}^k \paren {-1}^j f^{\paren {k - j} } g^{\paren j} + \paren {-1}^{k + 1} \int f g^{\paren {k + 1} } \rd x$

Induction Step
This is our induction step:

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

Therefore:
 * $\displaystyle \forall n \in \N_{>0}: \int f^{\paren n} g \rd x = \sum_{j \mathop = 0}^{n - 1} \paren {-1}^j f^{\paren {n - j - 1} } g^{\paren j} + \paren {-1}^n \int f g^{\paren n} \rd x$

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