# A closed form for $\int x^nf(x)\mathrm{d}x$

When trying to find a closed form for the expression

$$\int x^nf(x)\mathrm{d}x$$

in terms of integrals of $f(x)$ I found that

$$\int xf(x)\mathrm{d}x=x\int f(x)\mathrm{d}x-\iint f(x)(\mathrm{d}x)^2$$

$$\int x^2f(x)\mathrm{d}x=x^2\int f(x)\mathrm{d}x-2x\iint f(x)(\mathrm{d}x)^2+2\iiint f(x)(\mathrm{d}x)^3$$

$$\int x^3f(x)\mathrm{d}x=x^3\int f(x)\mathrm{d}x-3x^2\iint f(x)(\mathrm{d}x)^2+6x\iiint f(x)(\mathrm{d}x)^3-6\iiiint f(x)(\mathrm{d}x)^4$$

In general, it seems to be the case that

$$\int x^nf(x)\mathrm{d}x=\sum_{k=0}^n(-1)^k\frac{\mathrm{d}^k}{(\mathrm{d}x)^k}x^n\int^{k+1}f(x)(\mathrm{d}x)^{k+1}$$

Using a formula for the repeated derivative of a power function

$$\frac{\mathrm{d}^k}{(\mathrm{d}x)^k}x^n=\frac{n!}{(n-k)!}x^{n-k}$$

we obtain

$$\int x^nf(x)\mathrm{d}x=\sum_{k=0}^n(-1)^k\frac{n!}{(n-k)!}x^{n-k}\int^{k+1}f(x)(\mathrm{d}x)^{k+1}$$

Using the Cauchy formula for repeated integration

$$\int^{k+1} f(x)(\mathrm{d}x)^{k+1}=\frac{1}{k!}\int_a^x(x-t)^kf(t)\mathrm{d}t$$

we obtain

$$\int x^nf(x)\mathrm{d}x=\sum_{k=0}^n(-1)^k\frac{n!}{(n-k)!}x^{n-k}\frac{1}{k!}\int_a^x(x-t)^kf(t)\mathrm{d}t$$

which simplifies to

$$\int x^nf(x)\mathrm{d}x=\sum_{k=0}^n(-1)^k{n\choose k}x^{n-k}\int_a^x(x-t)^kf(t)\mathrm{d}t$$

which further simplifies to

$$\int x^nf(x)\mathrm{d}x=\int_a^xf(t)\mathrm{d}t\sum_{k=0}^n(t-x)^k{n\choose k}x^{n-k}=\int_a^xt^nf(t)\mathrm{d}t$$

Hence the formula

$$\int x^nf(x)\mathrm{d}x=\sum_{k=0}^n(-1)^k\frac{n!}{(n-k)!}x^{n-k}\int^{k+1}f(x)(\mathrm{d}x)^{k+1}$$

appears to be correct. Is there a way to extend this approach to find

$$\int x^nf(x)\mathrm{d}x$$

in terms of integrals of $f(x)$ for non-integer values of $n$?