In
elementary algebra
Elementary algebra, also known as high school algebra or college algebra, encompasses the basic concepts of algebra. It is often contrasted with arithmetic: arithmetic deals with specified numbers, whilst algebra introduces variable (mathematics ...
, a difference of two squares is one
squared number (the number multiplied by itself)
subtracted from another squared number. Every difference of squares may be
factored as the
product of the
sum of the two numbers and the
difference of the two numbers:
In the reverse direction, the product of any two numbers can be expressed as the difference between the square of their
average
In colloquial, ordinary language, an average is a single number or value that best represents a set of data. The type of average taken as most typically representative of a list of numbers is the arithmetic mean the sum of the numbers divided by ...
and the square of half their difference:
Proof
Algebraic proof
The
proof
Proof most often refers to:
* Proof (truth), argument or sufficient evidence for the truth of a proposition
* Alcohol proof, a measure of an alcoholic drink's strength
Proof may also refer to:
Mathematics and formal logic
* Formal proof, a co ...
of the factorization identity is straightforward. Starting from the
right-hand side, apply the
distributive law
In mathematics, the distributive property of binary operations is a generalization of the distributive law, which asserts that the equality
x \cdot (y + z) = x \cdot y + x \cdot z
is always true in elementary algebra.
For example, in elementary ...
to get
By the
commutative law
In mathematics, a binary operation is commutative if changing the order of the operands does not change the result. It is a fundamental property of many binary operations, and many mathematical proofs depend on it. Perhaps most familiar as a p ...
, 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 mathematics, the inequality of arithmetic and geometric means, or more briefly the AM–GM inequality, states that the arithmetic mean of a list of non-negative real numbers is greater than or equal to the geometric mean of the same list; and ...
in two variables.
The proof holds not only for numbers, but for elements of any
commutative ring
In mathematics, a commutative ring is a Ring (mathematics), ring in which the multiplication operation is commutative. The study of commutative rings is called commutative algebra. Complementarily, noncommutative algebra is the study of ring prope ...
. Conversely, if this identity holds in a
ring
(The) Ring(s) may refer to:
* Ring (jewellery), a round band, usually made of metal, worn as ornamental jewelry
* To make a sound with a bell, and the sound made by a bell
Arts, entertainment, and media Film and TV
* ''The Ring'' (franchise), a ...
for all pairs of elements and , then 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 , we must have
for all pairs , , so is commutative.
Geometric proof
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.
. The area of the shaded part can be found by adding the areas of the two rectangles;
, which can be factorized to
. Therefore,
.
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; thus, the area of the shaded region is
. 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
and whose height is
. This rectangle's area is
. Since this rectangle came from rearranging the original figure, it must have the same area as the original figure. Therefore,
.
Usage
Factorization of polynomials and simplification of expressions
The formula for the difference of two squares can be used for factoring
polynomial
In mathematics, a polynomial is a Expression (mathematics), mathematical expression consisting of indeterminate (variable), indeterminates (also called variable (mathematics), variables) and coefficients, that involves only the operations of addit ...
s that contain the square of a first quantity minus the square of a second quantity. For example, the polynomial
can be factored as follows:
As a second example, the first two terms of
can be factored as
, so we have:
Moreover, this formula can also be used for simplifying expressions:
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
In mathematics, a complex number is an element of a number system that extends the real numbers with a specific element denoted , called the imaginary unit and satisfying the equation i^= -1; every complex number can be expressed in the for ...
coefficients.
For example, the complex roots of
can be found using difference of two squares:
Therefore, the linear factors are
and
.
Since the two factors found by this method are
complex conjugate
In mathematics, the complex conjugate of a complex number is the number with an equal real part and an imaginary part equal in magnitude but opposite in sign. That is, if a and b are real numbers, then the complex conjugate of a + bi is a - ...
s, 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.
Rationalising denominators
The difference of two squares can also be used, in reverse, in the
rationalising of
irrational
Irrationality is cognition, thinking, talking, or acting without rationality.
Irrationality often has a negative connotation, as thinking and actions that are less useful or more illogical than other more rational alternatives. The concept of ...
denominator
A fraction (from , "broken") represents a part of a whole or, more generally, any number of equal parts. When spoken in everyday English, a fraction describes how many parts of a certain size there are, for example, one-half, eight-fifths, thre ...
s. This is a method for removing
surds from expressions (or at least moving them), applying to division by some combinations involving
square root
In mathematics, a square root of a number is a number such that y^2 = x; in other words, a number whose ''square'' (the result of multiplying the number by itself, or y \cdot y) is . For example, 4 and −4 are square roots of 16 because 4 ...
s.
For example, the denominator of
can be rationalised as follows:
Here, the irrational denominator
has been rationalised to
.
Mental arithmetic
The difference of two squares can also be used as an arithmetical shortcut. If two numbers have an easily squared average, their product can be rewritten as the difference of two squares. For example:
Difference of two consecutive perfect squares
The difference of two consecutive
perfect squares is the sum of the two
bases and . This can be seen as follows:
Therefore, the difference of two consecutive perfect squares is an odd number. Similarly, the difference of two arbitrary perfect squares is calculated as follows:
Therefore, the difference of two even perfect squares is a multiple of and the difference of two odd perfect squares is a multiple of .
Galileo's law of odd numbers
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. That is, if a body falling from rest covers a certain distance during an arbitrary time interval, it will cover , , , etc. times that distance in the subsequent time intervals of the same length.
From the equation for uniform linear acceleration, the distance covered
for initial speed
constant acceleration
(acceleration due to gravity without air resistance), and time elapsed
it follows that the distance
is proportional to
(in symbols,
), thus the distance from the starting point are consecutive squares for integer values of time elapsed.
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
, for
. If one of the
equals a perfect square
, then
is a (potentially non-trivial) factorization of
.
This trick can be generalized as follows. If
mod
and
mod
, then
is composite with non-trivial factors
and
. 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 Miller–Rabin primality test or Rabin–Miller primality test is a probabilistic primality test: an algorithm which determines whether a given number is likely to be prime, similar to the Fermat primality test and the Solovay–Strassen pr ...
.
Generalizations
The identity also holds in
inner product space
In mathematics, an inner product space (or, rarely, a Hausdorff pre-Hilbert space) is a real vector space or a complex vector space with an operation called an inner product. The inner product of two vectors in the space is a scalar, ofte ...
s over the
field of
real numbers
In mathematics, a real number is a number that can be used to measurement, measure a continuous variable, continuous one-dimensional quantity such as a time, duration or temperature. Here, ''continuous'' means that pairs of values can have arbi ...
, such as for
dot product
In mathematics, the dot product or scalar productThe term ''scalar product'' means literally "product with a Scalar (mathematics), scalar as a result". It is also used for other symmetric bilinear forms, for example in a pseudo-Euclidean space. N ...
of
Euclidean vector
In mathematics, physics, and engineering, a Euclidean vector or simply a vector (sometimes called a geometric vector or spatial vector) is a geometric object that has magnitude (or length) and direction. Euclidean vectors can be added and scal ...
s:
:
The proof is identical. For the special case that and have equal
norms (which means that their dot squares are equal), this demonstrates
analytically the fact that two diagonals of a
rhombus
In plane Euclidean geometry, a rhombus (: rhombi or rhombuses) is a quadrilateral whose four sides all have the same length. Another name is equilateral quadrilateral, since equilateral means that all of its sides are equal in length. The rhom ...
are
perpendicular
In geometry, two geometric objects are perpendicular if they intersect at right angles, i.e. at an angle of 90 degrees or π/2 radians. The condition of perpendicularity may be represented graphically using the '' perpendicular symbol'', � ...
. 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 (the long diagonal of the rhombus) dotted with the vector difference (the short diagonal of the rhombus) must equal zero, which indicates the diagonals are perpendicular.
Difference of two ''n''th powers

If and are two elements of a commutative ring, then
The second factor looks similar to the
binomial expansion of
, except that it does not include the
binomial coefficient
In mathematics, the binomial coefficients are the positive integers that occur as coefficients in the binomial theorem. Commonly, a binomial coefficient is indexed by a pair of integers and is written \tbinom. It is the coefficient of the t ...
s .
See also
*
Sum of two cubes
*
Binomial number
*
Sophie Germain's identity
*
Aurifeuillean factorization
*
Congruum, the shared difference of three squares in arithmetic progression
*
Conjugate (algebra)
*
Factorization
In mathematics, factorization (or factorisation, see American and British English spelling differences#-ise, -ize (-isation, -ization), English spelling differences) or factoring consists of writing a number or another mathematical object as a p ...
Notes
Further reading
*
*{{cite book , first1=Alan S. , last1=Tussy , first2=Roy David , last2=Gustafson , title=Elementary Algebra , edition=5th , publisher=Cengage Learning , year=2011 , isbn=978-1-111-56766-8 , pages=467–469 , url=https://books.google.com/books?id=xwOrtVKSVpoC&pg=PA467
External links
difference of two squaresat mathpages.com
Algebraic identities
Commutative algebra
Articles containing proofs
Subtraction