This is LaTeX code:

[latex]
$\begin{align*}A + B &= A + B, \\
(A+B)^2 &= A^2 + AB + BA + B^2 = A^2 + (1+x)AB + B^2, \\
(A+B)^3 &= (A^2 + (1+x)AB + B^2)(A+B) = A^3 + (1+x)ABA + B^2A + A^2B + (1+x)AB^2 + B^3 \\
&= A^3 + (1+x)xA^2B + x^2AB^2 + A^2B + (1+x)AB^2 + B^3 \\
&= A^3 + (x^2+x+1)A^2B + (x^2+x+1)AB^2 + B^3 \\
&\ \,\vdots
\end{align*}
[/latex]