(a+b)^3
=(a+b)(a+b)(a+b)
=(a^2+2ab+b^2)(a+b)
=(a^2+2ab+b^2)*a+(a^2+2ab+b^2)*b
=a^3+a^2b+2a^2b+2ab^2+ab^2+b^3
=a^3+3a^2b+3ab^2+b^3
(a+b)^3
=(a+b)(a+b)(a+b)
=(a^2+2ab+b^2)(a+b)
=(a^2+2ab+b^2)*a+(a^2+2ab+b^2)*b
=a^3+a^2b+2a^2b+2ab^2+ab^2+b^3
=a^3+3a^2b+3ab^2+b^3