Artificial intelligent assistant

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?

The second equality is the typical trick of adding/subtracting things until you get something you want. It is usually not terribly insightful but is nonetheless standard. In general, one can factor $a^n-b^n$ as $$ a^n-b^n = (a-b)(a^{n-1} + a^{n-2}b^1 + a^{n-3}b^2 + \cdots + a^2 b^{n-3} + a b^{n-2} + b^{n-1}).$$ One way of seeing this more general result is as follows: Consider the polynomial equation $x^3-b^3$ (where I have just used $x$ instead of $a$!). Clearly $x=b$ is a root of this equation, so we should be able to factor out an $(x-b)$ term from the polynomial. Polynomial long division then gives the desired result. This can be generalized to higher $n$.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy d8c377091264c0aa1b58c2898fabb6eb