Awesome, thanks for showing the two methods.
But I have some questions about them that I was wondering if you can please clarify:
Well, I guessed based on experience. If you want to integrate f(x), can you see that the derivative of x*f(x) = f(x) + x f'(x)? So, in some cases, x f'(x) is easier to integrate. That's what I did in the first method.
Now, look carefully at both sides.
int(u dv/dx dx) = uv - int(v du/dx dx)
On the left hand side, we have u dv/dx to be integrate. On the right hand side, we have v du/dx to be integrated. Basically, on the left you have a product of u and the derivative of v under the integral sign, whereas on the right hand side you have v and the derivative of u under the integral sign. Sure, you're integrating both sides, but you're integrating different things.
Then, remember how we get to choose u and v? Well, when letting u = (ln x)^2 and dv/dx = 1, we can choose v to be anything as long as dv/dx = 1. I've just chosen v = x for simplicity as it does satisfy dv/dx = 1 and the resulting integral is simpler.