<s>[INST] Factoring $a^3-b^3$ I recently got interested in mathematics after having slacked through it in highschool. Therefore I picked up the book "Algebra" by I.M. Gelfand and A.Shen
At problem 113, the reader is asked to factor $a^3-b^3.$
The given solution is: 
$$a^3-b^3 = a^3 - a^2b + a^2b -ab^2 + ab^2 -b^3 = a^2(a-b) + ab(a-b) + b^2(a-b) = (a-b)(a^2+ab+b^2)$$
I was wondering how the second equality is derived. From what is it derived, from $a^2-b^2$? I know that the result is the difference of cubes formula, however searching for it on the internet i only get exercises where the formula is already given. Can someone please point me in the right direction?
 [/INST] The second equality is obtained by first grouping terms in the middle expression and then factoring the grouped terms:
$$\begin{align}
a^3-a^2b+a^2b-ab^2+ab^2-b^3&=(a^3-a^2b)+(a^2b-ab^2)+(ab^2-b^3)\cr
&=a^2(a-b)+ab(a-b)+b^2(a-b)\cr
\end{align}$$
If the OP is wondering where the middle expression came from in the first place, it's kind of a deus ex machina:  All you're doing is sticking two $0$'s between $a^3$ and $-b^3$ (the expressions $-a^2b+a^2b$ and $-ab^2+ab^2$ are both obviously equal to $0$), but when you do, lo and behold, the regrouping and factoring work their magic.  
</s>