Difference of two squares

From HandWiki
Short description: Mathematical identity of polynomials

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

[math]\displaystyle{ a^2-b^2 = (a+b)(a-b) }[/math]

in elementary algebra.

Proof

The proof of the factorization identity is straightforward. Starting from the right-hand side, apply the distributive law to get

[math]\displaystyle{ (a+b)(a-b) = a^2+ba-ab-b^2 }[/math]

By the commutative law, the middle two terms cancel:

[math]\displaystyle{ ba - ab = 0 }[/math]

leaving

[math]\displaystyle{ (a+b)(a-b) = a^2-b^2 }[/math]

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.

The proof holds in any commutative ring.

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

[math]\displaystyle{ a^2 + ba - ab - b^2 }[/math].

For this to be equal to [math]\displaystyle{ a^2 - b^2 }[/math], we must have

[math]\displaystyle{ ba - ab = 0 }[/math]

for all pairs a, b, so R is commutative.

Geometrical demonstrations

Difference of two squares.svg

The difference of two squares can also be illustrated geometrically as the difference of two square areas in a plane. In the diagram, the shaded part represents the difference between the areas of the two squares, i.e. [math]\displaystyle{ a^2 - b^2 }[/math]. The area of the shaded part can be found by adding the areas of the two rectangles; [math]\displaystyle{ a(a-b) + b(a-b) }[/math], which can be factorized to [math]\displaystyle{ (a+b)(a-b) }[/math]. Therefore, [math]\displaystyle{ a^2 - b^2 = (a+b)(a-b) }[/math].

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. The side of the entire square is a, and the side of the small removed square is b. The area of the shaded region is [math]\displaystyle{ a^2-b^2 }[/math]. 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. Now the smaller piece can be detached, rotated, and placed to the right of the larger piece. In this new arrangement, shown in the last diagram below, the two pieces together form a rectangle, whose width is [math]\displaystyle{ a+b }[/math] and whose height is [math]\displaystyle{ a-b }[/math]. This rectangle's area is [math]\displaystyle{ (a+b)(a-b) }[/math]. Since this rectangle came from rearranging the original figure, it must have the same area as the original figure. Therefore, [math]\displaystyle{ a^2-b^2 = (a+b)(a-b) }[/math]. Difference of two squares geometric proof.png

Uses

Factorization of polynomials and simplification of expressions

The formula for the difference of two squares can be used for factoring polynomials that contain the square of a first quantity minus the square of a second quantity. For example, the polynomial [math]\displaystyle{ x^4 - 1 }[/math] can be factored as follows:

[math]\displaystyle{ x^4 - 1 = (x^2 + 1)(x^2 - 1) = (x^2 + 1)(x + 1)(x - 1) }[/math]

As a second example, the first two terms of [math]\displaystyle{ x^2 - y^2 + x - y }[/math] can be factored as [math]\displaystyle{ (x + y)(x - y) }[/math], so we have:

[math]\displaystyle{ x^2 - y^2 + x - y = (x + y)(x - y) + x - y = (x - y)(x + y + 1) }[/math]

Moreover, this formula can also be used for simplifying expressions:

[math]\displaystyle{ (a+b)^2-(a-b)^2=(a+b+a-b)(a+b-a+b)=(2a)(2b)=4ab }[/math]

Complex number case: sum of two squares

The difference of two squares is used to find the linear factors of the sum of two squares, using complex number coefficients.

For example, the complex roots of [math]\displaystyle{ z^2 + 4 }[/math] can be found using difference of two squares:

[math]\displaystyle{ z^2 + 4 }[/math]
[math]\displaystyle{ = z^2 - 4i^2 }[/math] (since [math]\displaystyle{ i^2 = -1 }[/math])
[math]\displaystyle{ = z^2 - (2 i)^2 }[/math]
[math]\displaystyle{ = (z + 2 i)(z - 2 i) }[/math]

Therefore, the linear factors are [math]\displaystyle{ (z + 2 i) }[/math] and [math]\displaystyle{ (z - 2 i) }[/math].

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. This is used to get real denominators in complex fractions.[1]

Rationalising denominators

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.

For example: The denominator of [math]\displaystyle{ \dfrac{5}{\sqrt{3} + 4} }[/math] can be rationalised as follows:

[math]\displaystyle{ \dfrac{5}{\sqrt{3} + 4} }[/math]
[math]\displaystyle{ = \dfrac{5}{\sqrt{3} + 4} \times \dfrac{\sqrt{3} - 4}{\sqrt{3} - 4} }[/math]
[math]\displaystyle{ = \dfrac{5(\sqrt{3} - 4)}{(\sqrt{3} + 4)(\sqrt{3} - 4)} }[/math]
[math]\displaystyle{ = \dfrac{5(\sqrt{3} - 4)}{\sqrt{3}^2 - 4^2} }[/math]
[math]\displaystyle{ = \dfrac{5(\sqrt{3} - 4)}{3 - 16} }[/math]
[math]\displaystyle{ = -\dfrac{5(\sqrt{3} - 4)}{13}. }[/math]

Here, the irrational denominator [math]\displaystyle{ \sqrt{3} + 4 }[/math] has been rationalised to [math]\displaystyle{ 13 }[/math].

Mental arithmetic

The difference of two squares can also be used as an arithmetical short cut. If two numbers (whose average is a number which is easily squared) are multiplied, the difference of two squares can be used to give you the product of the original two numbers.

For example:

[math]\displaystyle{ 27 \times 33 = (30 - 3)(30 + 3) }[/math]

Using the difference of two squares, [math]\displaystyle{ 27 \times 33 }[/math] can be restated as

[math]\displaystyle{ a^2 - b^2 }[/math] which is [math]\displaystyle{ 30^2 - 3^2 = 891 }[/math].

Difference of two consecutive perfect squares

The difference of two consecutive perfect squares is the sum of the two bases n and n+1. This can be seen as follows:

[math]\displaystyle{ \begin{array}{lcl} (n+1)^2 - n^2 & = & ((n+1)+n)((n+1)-n) \\ & = & 2n+1 \end{array} }[/math]

Therefore, the difference of two consecutive perfect squares is an odd number. Similarly, the difference of two arbitrary perfect squares is calculated as follows:

[math]\displaystyle{ \begin{array}{lcl} (n+k)^2 - n^2 & = & ((n+k)+n)((n+k)-n) \\ & = & k(2n+k) \end{array} }[/math]

Therefore, the difference of two even perfect squares is a multiple of 4 and the difference of two odd perfect squares is a multiple of 8.

Factorization of integers

Several algorithms in number theory and cryptography use differences of squares to find factors of integers and detect composite numbers. A simple example is the Fermat factorization method, which considers the sequence of numbers [math]\displaystyle{ x_i:=a_i^2-N }[/math], for [math]\displaystyle{ a_i:=\left\lceil \sqrt{N}\right\rceil+i }[/math]. If one of the [math]\displaystyle{ x_i }[/math] equals a perfect square [math]\displaystyle{ b^2 }[/math], then [math]\displaystyle{ N=a_i^2-b^2=(a_i+b)(a_i-b) }[/math] is a (potentially non-trivial) factorization of [math]\displaystyle{ N }[/math].

This trick can be generalized as follows. If [math]\displaystyle{ a^2\equiv b^2 }[/math] mod [math]\displaystyle{ N }[/math] and [math]\displaystyle{ a\not\equiv \pm b }[/math] mod [math]\displaystyle{ N }[/math], then [math]\displaystyle{ N }[/math] is composite with non-trivial factors [math]\displaystyle{ \gcd(a-b,N) }[/math] and [math]\displaystyle{ \gcd(a+b,N) }[/math]. 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.

Generalizations

Vectors a (purple), b (cyan) and a + b (blue) are shown with arrows

The identity also holds in inner product spaces over the field of real numbers, such as for dot product of Euclidean vectors:

[math]\displaystyle{ {\mathbf a}\cdot{\mathbf a} - {\mathbf b}\cdot{\mathbf b} = ({\mathbf a}+{\mathbf b})\cdot({\mathbf a}-{\mathbf b}) }[/math]

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.

Difference of two nth powers

Visual proof of the differences between two squares and two cubes

If a and b are two elements of a commutative ring R, then [math]\displaystyle{ a^n-b^n=\left(a-b\right)\left(\sum_{k=0}^{n-1} a^{n-1-k}b^k\right) }[/math].

History

Historically, the Babylonians used the difference of two squares to calculate multiplications. [3]

For example:

93 × 87 = 90² − 3² = 8091

64 × 56 = 60² − 4² = 3584

See also

Notes

References

External links