Difference of two squares

In mathematics, the difference of two squares is a squared (multiplied by itself) number subtracted from another squared number. Every difference of squares may be factored according to the identity
in elementary algebra.
Proof.
Starting from the left-hand side, use the distributive law to get
By the commutative law, the middle two terms cancel:
leaving
The result is one of the most commonly used identities in mathematics. Among other many uses, it gives simple proof of the AM–GM inequality in two variables.
The proof holds in any commutative ring.
However, if this identity holds in a ring "R" for all pairs of elements "a" and "b". This means "R" is commutative. To see this, use the distributive law on the right-hand side of the equation and get
For this equation to be equal to formula_6, we must have
for all pairs "a", and "b". So that "R" is commutative.