Every difference of squares may be factored according to the identity in elementary algebra.
Starting from the right-hand side, apply the distributive law to get By the commutative law, the middle two terms cancel: leaving The resulting identity is one of the most commonly used in mathematics.
Among many uses, it gives a simple proof of the AM–GM inequality in two variables.
Conversely, if this identity holds in a ring R for all pairs of elements a and b, then R is commutative.
To see this, apply the distributive law to the right-hand side of the equation and get For this to be equal to
In the diagram, the shaded part represents the difference between the areas of the two squares, i.e.
Another geometric proof proceeds as follows: We start with the figure shown in the first diagram below, a large square with a smaller square removed from it.
A cut is made, splitting the region into two rectangular pieces, as shown in the second diagram.
The larger piece, at the top, has width a and height a-b.
The smaller piece, at the bottom, has width a-b and height b.
In this new arrangement, shown in the last diagram below, the two pieces together form a rectangle, whose width is
, so we have: Moreover, this formula can also be used for simplifying expressions: The difference of two squares is used to find the linear factors of the sum of two squares, using complex number coefficients.
can be found using difference of two squares: Therefore, the linear factors are
Since the two factors found by this method are complex conjugates, we can use this in reverse as a method of multiplying a complex number to get a real number.
[1] The difference of two squares can also be used in the rationalising of irrational denominators.
[2] This is a method for removing surds from expressions (or at least moving them), applying to division by some combinations involving square roots.
The difference of two squares can also be used as an arithmetical short cut.
can be restated as The difference of two consecutive perfect squares is the sum of the two bases n and n+1.
This can be seen as follows: Therefore, the difference of two consecutive perfect squares is an odd number.
A ramification of the difference of consecutive squares, Galileo's law of odd numbers states that the distance covered by an object falling without resistance in uniform gravity in successive equal time intervals is linearly proportional to the odd numbers.
From the equation for uniform linear acceleration, the distance covered
(acceleration due to gravity without air resistance), and time elapsed
), thus the distance from the starting point are consecutive squares for integer values of time elapsed.
A simple example is the Fermat factorization method, which considers the sequence of numbers
This forms the basis of several factorization algorithms (such as the quadratic sieve) and can be combined with the Fermat primality test to give the stronger Miller–Rabin primality test.
The identity also holds in inner product spaces over the field of real numbers, such as for dot product of Euclidean vectors: The proof is identical.
For the special case that a and b have equal norms (which means that their dot squares are equal), this demonstrates analytically the fact that two diagonals of a rhombus are perpendicular.
This follows from the left side of the equation being equal to zero, requiring the right side to equal zero as well, and so the vector sum of a + b (the long diagonal of the rhombus) dotted with the vector difference a - b (the short diagonal of the rhombus) must equal zero, which indicates the diagonals are perpendicular.
Note that the second factor looks similar to the binomial expansion of
Historically, the Babylonians used the difference of two squares to calculate multiplications.