One night, I discovered an integration relationship. That relationship allows to quickly integrate squares of functions (and even more, but I will talk about this at the end).
I was wondering if anyone has found a formula like this before. So I researched on the internet, but couldn't find anything like this.
The formula:
$$\int f(x)^2\,dx\;=\;xf(x)^2\;-\;2f(x)\cdot F^{-1}_{(1)}(f(x))\;+\;2\,\cdot F^{-1}_{(2)}(f(x))\;+\;C$$
Where $F^{-1}_{(n)}$ denotes the $n$th anti-derivative of the inverse function of $f$.
The formula looks rather complicated, but it's really not, on further inspection. Note: the formula doesn't work on the function $f(x)=x$ for a reason that I wasn't able to determine yet. Edit: it actually works.
An example in action:
Let's compute $\int \ln^2x\,dx$. We have then:
$f(x)=\ln x$
$f^{-1}(x)=e^x$
$F^{-1}_{(1)}(x)=e^x$
$F^{-1}_{(2)}(x)=e^x$
Applying the formula, the integral becomes:
$$\int\ln^2x\,dx=x\ln^2x-2\ln x\cdot e^{\ln x}+2\cdot e^{\ln x}+C$$ $$=x\ln^2x-2x\ln x+2x+C$$
Derivation (for the curious):
I derived this formula by substituting for inverse functions and doing repeated integration by parts.
First, substitute $x=f^{-1}(u)$. Then, we have $dx=df^{-1}(u)$. This changes the original integral to:
$$\int f(x)^2\,dx=\int f(f^{-1}(u))^2\,df^{-1}(u)=\int u^2\,df^{-1}(u)$$
At this point, I did integration by parts (probably the funkiest integration by parts you have ever seen). Note, that I am using the "DI table" trick for integration by parts, where in one column, derivatives of one function are specified, and integrals of another are put into the other column. Terms are multiplied diagonally left-down.
$$\begin{array}{ l | c | r } \pm & D & I \\ \hline + & u^2 & df^{-1}(u) \\ - & 2u & f^{-1}(u) \\ + & 2 & F^{-1}_{(1)}(u) \\ - & 0 & F^{-1}_{(2)}(u) \\ \end{array}$$
$$\int u^2\,df^{-1}(u)\;=\;u^2f^{-1}(u)-2uF^{-1}_{(1)}(u)+2F^{-1}_{(2)}(u)+C$$
Now, simply subsitute back $u=f(x)$ and we arrive at the formula.
Generalization to composition of functions:
It didn't take long for me to realize that this method can be extended to compositions of functions. Just for the curious folks, this is my integral of composition formula:
$$\int f(g(x))\,dx\;=\;\sum^{\infty}_{k=0}(-1)^k\cdot D_k(g(x))\cdot A_k(g(x)) + C$$
Where $D_k={d^k f\over dx^k}$ and $A_k={d^{-k}g^{-1}\over dx^{-k}}$.
Interesting, isn't it?
Back to the question:
Have I discovered this formula? If I didn't can someone point me to a further reading on this topic? I really can't find anything myself, probably because I don't know how to search.