My calculus-book gives an example of integration using the method of judicious guessing. But I do not intuit the method very well.
QUESTION: How does the derivative of $f_{mn}(x)$ "suggest that we try" $I=Px^4\left(\log {x}\right)^2 +Qx^4\log{x}+Rx^4+C$? Where does this trial formula come from?
The example goes as follows:
Find the derivative of $f_{mn}(x)=x^m\left(\log {x}\right)^n$ and use the result to suggest a trial formula for $I=\int x^3\left(\log {x}\right)^2dx$. Thus evaluate this integral.
Solution: We have $$f'_{mn}(x)=mx^{m-1}\left(\log {x}\right)^n+nx^{m-1}\left(\log {x}\right)^{n-1}.$$ This suggests that we try $$I=Px^4\left(\log {x}\right)^2+Qx^4\log{x}+Rx^4+C$$ for constants $P$, $Q$, $R$ and $C$. Differentiating we get $$\frac{dI}{dx} = 4Px^3\left(\log {x}\right)^2 + 2Px^3\log{x} + 4Qx^3\log{x} + Qx^3 + 4Rx^3 = x^3\left(\log {x}\right)^2,$$ solving for $P$, $Q$ and $R$ we arrive at the right answer: $$\int x^3\left(\log {x}\right)^2dx=\frac{1}{4}x^4\left(\log {x}\right)^2-\frac{1}{8}x^4\log{x}+\frac{1}{32}x^4+C.$$
Please note my level of mathematics is still "in development": I am learning without a teacher.
BACKGROUND: In my efforts I did notice the following, which also results in the right answer: $$\frac{d}{dx}x^m\left(\log {x}\right)^n=mx^{m-1}\left(\log {x}\right)^n+nx^{m-1}\left(\log {x}\right)^{n-1}.$$ Integrating both sides we get: $$x^m\left(\log {x}\right)^n=m\int x^{m-1}\left(\log {x}\right)^n dx+n\int x^{m-1}\left(\log {x}\right)^{n-1}dx.$$ Now we can define $g_{mn}(x)$ as follows: $$g_{mn}\left(x\right)=\int x^{m-1}\left(\log {x}\right)^n dx=\frac{1}{m}x^m\left(\log {x}\right)^n-\frac{n}{m}\int x^{m-1}\left(\log {x}\right)^{n-1}dx.$$ Taking $m=4$ and $n=2$ we get: \begin{align} I&=\int x^3\left(\log {x}\right)^2dx=g_{42}(x)=\frac{1}{4}x^4\left(\log {x}\right)^2-\frac{1}{2}\int x^3\log{x}\,dx\\ &=\frac{1}{4}x^4\left(\log {x}\right)^2-\frac{1}{2}g_{41}(x)=\frac{1}{4}x^4\left(\log {x}\right)^2-\frac{1}{8}x^4\log{x}+\frac{1}{32}x^4+C. \end{align}