First Part: Indefinite Integral
To do this, we'll need to integrate by parts:
`int f'(x)g(x) dx = f(x)g(x) - int f(x)g'(x) dx`
We'll let f'(x) = ln(x) and g(x) = ln(x). We end up with the following as a result:
f'(x) = ln(x), so f(x) = xln(x) - x (You can verify this by taking the derivative).
g(x) = ln(x), so g'(x) = `1/x`
Now, we can put our overall problem into the above integration by parts equation:
`int ln^2(x)dx = ln(x)(xln(x) - x) - int (xln(x) - x)*1/x dx`
`int ln^2(x) dx = xln^2(x) - xln(x) - int ln(x) - 1 dx`
Now, we need to take the antiderivative of ln(x) - 1, so we just recognize that, as when we were trying to differentiate by parts that int(ln(x)dx) will be xln(x) - x (Like when we were trying to find the f(x) for our integration by parts). We then add this to the integral of -1 to get this particular indefinite integral (don't forget your constant of integration!):
`int ln^2(x) dx = xln^2(x) - xln(x) - (xlnx - x - x + C)`
`int ln^2(x) dx = xln^2(x) - 2xln(x) + 2x - C`
Keep in mind that I can arbitrarily change the sign of C because it's just a constant of integration.
We can't simplify any more, so our indefinite integral is the following:
`xln^2(x) - 2xln(x) + 2x + C`
Evaluating the definite integral
Now, to evaluate the definite integral, we just put 2 into the above result and subtract what we get if we put 1 into the above result, seen below:
`2ln^2(2) - 2*2ln(2) + 2*2 + C - (1ln^2(1) - 2*1ln(1) + 2*1 + C)`
Recall, ln(1) = 0 because e^0 = 1. Now, we can hugely simplify by getting rid of any term containing ln(1).
`= 2ln^2(2) - 4ln(2) + 4 + C - 2 - C`
`= 2ln^2(2) - 4ln(2) + 2`
Now we distribute out a "2":
`= 2(ln^2(2) - 2ln(2) + 1)`
Now, we will add some terms. Because ln(e) = 1, we can multiply everything by ln(e) as often as we wish! So, we'll multiply the 2ln(2) term by ln(e), and we'll multiply the 1 term by ln(e) twice! This gives us the following:
`= 2(ln^2(2) - 2ln(e)ln(2) + ln^2(e))`
At this point, you might be able to see that the above equation can be factored because it is a perfect square trinomial:
`= 2(ln(e) - ln(2))^2`
We now use logarithm rules (log(a) - log(b) = log(a/b)) to get the desired result, and we're done!
`=2(ln(e/2))^2 = 2ln^2(e/2)`