How do we get $(b-a)^2/12$ from factorisation? I am in the final steps of calculating the variance of the uniform distribution for $(a,b)$. I'd like to see the steps involved in getting $$\frac{1}{12}(b-a)^2$$ from $$\frac{4(b^3-a^3)-3(b-a)(a+b)^2}{12(b-a)}$$ which is the result after integrating the variable $X^2$ between $b$ and $a$ and subtracting the mean squared. I'm struggling to perform the algebra so I would appreciate any assistance you could provide in showing the steps involved. Thanks!

$4(b^3-a^3)-3(b-a)(b+a)^2=4b^3-4a^3-3(b^2-a^2)(b+a)$ 
[using $(b-a)(b+a)=b^2-a^2$]
$=4b^3-4a^3-3b^3-3b^2a+3a^2b+3a^3$
$=b^3-3b^2a+3ba^2-a^3$
$=(b-a)^3\quad(*)$.
Dividing by $12(b-a)$ gives $\frac{1}{12}(b-a)^2$
So how did we do $(*)$? Well I did it because I recognize a few well-known factorisations like:
$(a+b)^2=a^2+2ab+b^2$
$(a+b)^3=a^3+3a^2b+3ab^2+b^3$
and the second of those gives you what you need if you replace $a$ by $-a$.
Suppose you don't recognize the factorisation immediately. The first thing to notice is whether every term has the same degree. It does here. So you can think of the expression as $a^3(x^3-3x^2+3x-1)$ where $x=b/a$. You may remember that checking a polynomial with integer coefficients for integer roots is easy: you just check the factors of the constant term. So the only possible integer roots of $x^3-3x^2+3x-1$ are $\pm1$. You quickly find that 1 is a root which means that $(x-1)$ is a factor. Find the other factor as $(x^2-2x+1)$. You can either factor that on sight or repeat the process to find that the polynomial is $(x-1)^3$ and hence the original is $(b-a)^3$.
