A while back, I was explaining to a friend a method to compute the indefinite integral of $\ln(x)$, by taking $\int \ln(x) \, dx$ and setting $u = \ln(x), du = \frac{1}{x} \, dx, dv = 1 \, dx, v = x$, then proceeding with integration by parts. However, I was wondering if this method could be generalized for any infinitely differentiable function $f(x)$, so I attempted the same method. Below is what I computed:
$\int f(x) \, dx$, so let $u = f(x), du = f'(x)\,dx, dv = 1\, dx, v = x \implies$
$x f(x) - \int x f'(x) \, dx$, so let $u = f'(x), du = f''(x) \, dx, dv = x \, dx, v = \frac{x^2}2 \implies$
$xf(x) - \frac{x^2} 2 f'(x) + \int \frac{x^2}2 f''(x) \, dx$, so let $u = f''(x), du = f'''(x) \, dx, dv = \frac{x^2} 2 \, dx, v = \frac{x^3} 6 \ldots$
This eventually yields $$\int f(x) \, dx= \sum_{n=1}^\infty \frac{x^n}{n!} (-1)^{n - 1} f^{(n-1)}(x),$$ where $f^{(n-1)}(x)$ represents the $(n-1)$-th derivative of $f(x)$ . At first glance, while this looks like a Taylor expansion, it is actually quite different. Firstly, the general Taylor expansion does not contain the $(-1)^{n-1}$ term that this sum does. Secondly, Taylor expansions are centered around some point, while this sum is not. Finally, and perhaps most notably, in a Taylor expansion, the derivatives are evaluated at a specific point, while in this expansion, they are left as functions. My questions, then, are the following:
Is this something new, or has it been documented before? (I've spent a lot of time looking to see if I could find something similar, and so far this has yielded nothing. But, if it has been done, I'd love to read more about it)
If this is novel (or even if it is not), what are some of the interesting consequences of this expression?
I really do appreciate all of your input and advice. I realize this is a little open ended, but it's been nagging at me for quite some while, and I'd love a second look. Thanks!
EDIT: As Alex Kruckman pointed out in the comments, the claim 'this eventually yields' leads to a loss of precision, specifically as it pertains to the $+C$ term in an indefinite integral. After spending some time thinking about this, I noted several remedies to this issue:
- Rather than express the integral as an infinite sum, we can represent it as a finite sum added to an 'error' term of sorts. In other words, we can say:
$$\int f(x)\, dx = \sum_{n=1}^k\left[\frac{x^n}{n!} (-1)^{n - 1} f^{(n-1)}(x)\right] + \int \frac{x^k}{k!}(-1)^{k}f^{(k)}(x) \, dx$$
- Interestingly, when considering the infinite sum, we note that every term has a polynomial component of at least degree one. This implies that if $x = 0$, the sum should evaluate to $0$ as well. Therefore, setting $G(x) = \int_{a}^{x} f(t) \, dt = F(x) - F(a)$, we see that as $G(0) = 0$, $F(0) - F(a) = 0,$ which implies $a = 0$. In other words, to make my original claim more precise, we can use the definite integral:
$$\int_{0}^{x} f(t) \, dt= \sum_{n=1}^\infty \frac{x^n}{n!} (-1)^{n - 1} f^{(n-1)}(x)$$
I believe these two edits help to eliminate the problem with the $+C$ term.
EDIT 2: I've tried a couple common functions to see how they interact with the formula. Considering $f(x) = e^x$, we have:
$$\begin{aligned}\int e^x \, dx&= \sum_{n=1}^\infty\frac{x^n}{n!} (-1)^{n - 1}e^x\\e^x + C &= e^x\cdot\sum_{n=1}^\infty\frac{x^n}{n!} (-1)^{n - 1}\\&= e^x\cdot(1 - e^{-x})=e^x-1\end{aligned}$$
This implies $C = -1$, a result consistent with the first edit, where we integrate from $0$ to $x$.
Similarly, considering $f(x) = e^{-x}$, we have:
$$\begin{aligned}\int e^{-x} \, dx= \sum_{n=1}^\infty \frac{x^n}{n!} (-1)^{n - 1} e^{-x} * (-1)^{(n-1)} = \sum_{n=1}^\infty \frac{x^n}{n!} * e^{-x}\\-e^{-x} + C = e^{-x} * \sum_{n=1}^\infty \frac{x^n}{n!} = e^{-x} * (e^x - 1) = 1 - e^{-x}\end{aligned}$$
This implies $C = 1$, which we would again get if we integrated from $0$ to $x$.
Now, I decided to consider $f(x) =\ln(x)$, a decidedly harder function to analyze in this respect, which also is not defined at 0. Here, we have:
$$\begin{aligned}\int\ln(x) \, dx&=\sum_{n=1}^\infty\frac{x^n}{n!}(-1)^{n - 1}\frac{d^{(n-1)}}{dx^{(n-1)}}\ln(x)\\x\cdot\ln(x)-x+C&=x\cdot\ln(x)+\sum_{n=2}^\infty\frac{x^n}{n!} (-1)^{n - 1} \frac{d^{(n-1)}}{dx^{(n-1)}}\ln(x)\\&=x\cdot\ln(x)-x+C&=x\cdot\ln(x)+\sum_{n=2}^\infty\frac{x^n}{n!} (-1)^{n - 1} \frac{(n-2)!}{x^{n-1}}\cdot(-1)^n\\x\cdot\ln(x)-x+C&=x\cdot\ln(x)-\sum_{n=2}^\infty\frac{x}{n(n-1)}\\&=x\cdot\ln(x)-x\end{aligned}$$
Interestingly, here, we see that $C = 0$. While $ln(x)$ is not defined at $0$, this intuitively still makes some sense, as we note $\lim\limits_{x\to0} (x\cdot\ln(x) - x) = 0$.