TITLE: Integration using "method of judicious guessing"
QUESTION [11 upvotes]: 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}

REPLY [3 votes]: Let me try to give a little insight into my thinking process when I see problems like that.

Objective: Compute explicitly integral $\,I=\int x^3\log^2 x\,dx$ by "trial and error".

Interpretation: Authors want you to guess "general form" of solution (meaning they want you to plug in some expression that you think might be solution, but without necessarily knowing exact coefficients, which can be adjusted later).

Hint: find the derivative of $\,f_{mn}\left(x\right)=x^m\log^nx$ and guess general solution of integral $\,I=\int x^3\log^2 x\,dx$ from there.

Interpretation: We need to guess a function whose derivative is $\, x^3\log^2 x$.
Since the result is product of powers of $x$ and $\log x$, it is reasonable to assume that the integrand has similar form, with maybe more terms and higher powers, but it should still have product of powers of $x$ and $\log x$ in order for its derivative to have required form.

Approach to Solution
Following the hint, we write down derivative of $\,f_{mn}\left(x\right)$ as $f'_{mn}(x)=mx^{m-1}\log^n{x}+nx^{m-1}\log^{n-1}{x}$.
Thus if we want the derivative of function to be $x^3\log^2 x$ we have
$ m-1 = 3$ as well as $n = 2$ or $n-1=2$.
Moreover, the derivative of $f_{mn}(x)$ has more than one term, thus if we seek for expression of whose derivative is $x^3\log^2 x$ we need to take linear combination of functions of the form $f_{mn}$ hoping that redundunt terms will cancel out.
More specifically, we see that in the integrand power of $\log x$ is smaller by $1$ than the power of $ x$, thus we conclude that we want to get rid of the term
$x^{m-1}\log^{n-1}{x}$ since it has the same powers.
From here on you can use trial and error to try to match and cancel redundant terms.