Completing the square
   HOME

TheInfoList



OR:

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 ...
, completing the square is a technique for converting a
quadratic polynomial In mathematics, a quadratic function of a single variable is a function of the form :f(x)=ax^2+bx+c,\quad a \ne 0, where is its variable, and , , and are coefficients. The expression , especially when treated as an object in itself rather tha ...
of the form to the form for some values of and . In terms of a new quantity , this expression is a quadratic polynomial with no linear term. By subsequently isolating and taking the
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 ...
, a quadratic problem can be reduced to a linear problem. The name ''completing the square'' comes from a geometrical picture in which represents an unknown length. Then the quantity represents the area of a
square In geometry, a square is a regular polygon, regular quadrilateral. It has four straight sides of equal length and four equal angles. Squares are special cases of rectangles, which have four equal angles, and of rhombuses, which have four equal si ...
of side and the quantity represents the area of a pair of
congruent Congruence may refer to: Mathematics * Congruence (geometry), being the same size and shape * Congruence or congruence relation, in abstract algebra, an equivalence relation on an algebraic structure that is compatible with the structure * In modu ...
rectangle In Euclidean geometry, Euclidean plane geometry, a rectangle is a Rectilinear polygon, rectilinear convex polygon or a quadrilateral with four right angles. It can also be defined as: an equiangular quadrilateral, since equiangular means that a ...
s with sides and . To this square and pair of rectangles one more square is added, of side length . This crucial step ''completes'' a larger square of side length . Completing the square is the oldest method of solving general
quadratic equation In mathematics, a quadratic equation () is an equation that can be rearranged in standard form as ax^2 + bx + c = 0\,, where the variable (mathematics), variable represents an unknown number, and , , and represent known numbers, where . (If and ...
s, used in
Old Babylonian Old Babylonian may refer to: *the period of the First Babylonian dynasty (20th to 16th centuries BC) *the historical stage of the Akkadian language Akkadian ( ; )John Huehnergard & Christopher Woods, "Akkadian and Eblaite", ''The Cambridge Enc ...
clay tablets dating from 1800–1600 BCE, and is still taught in elementary algebra courses today. It is also used for graphing
quadratic function In mathematics, a quadratic function of a single variable (mathematics), variable is a function (mathematics), function of the form :f(x)=ax^2+bx+c,\quad a \ne 0, where is its variable, and , , and are coefficients. The mathematical expression, e ...
s, deriving the
quadratic formula In elementary algebra, the quadratic formula is a closed-form expression describing the solutions of a quadratic equation. Other ways of solving quadratic equations, such as completing the square, yield the same solutions. Given a general quadr ...
, and more generally in computations involving quadratic polynomials, for example in
calculus Calculus is the mathematics, mathematical study of continuous change, in the same way that geometry is the study of shape, and algebra is the study of generalizations of arithmetic operations. Originally called infinitesimal calculus or "the ...
evaluating
Gaussian integral The Gaussian integral, also known as the Euler–Poisson integral, is the integral of the Gaussian function f(x) = e^ over the entire real line. Named after the German mathematician Carl Friedrich Gauss, the integral is \int_^\infty e^\,dx = \s ...
s with a linear term in the exponent, and finding
Laplace transform In mathematics, the Laplace transform, named after Pierre-Simon Laplace (), is an integral transform that converts a Function (mathematics), function of a Real number, real Variable (mathematics), variable (usually t, in the ''time domain'') to a f ...
s.


History

The technique of completing the square was known in the
Old Babylonian Empire The Old Babylonian Empire, or First Babylonian Empire, is dated to , and comes after the end of Sumerian power with the destruction of the Third Dynasty of Ur, and the subsequent Isin-Larsa period. The chronology of the first dynasty of Babylon ...
.
Muhammad ibn Musa Al-Khwarizmi Muhammad ibn Musa al-Khwarizmi , or simply al-Khwarizmi, was a mathematician active during the Islamic Golden Age, who produced Arabic-language works in mathematics, astronomy, and geography. Around 820, he worked at the House of Wisdom in B ...
, a famous
polymath A polymath or polyhistor is an individual whose knowledge spans many different subjects, known to draw on complex bodies of knowledge to solve specific problems. Polymaths often prefer a specific context in which to explain their knowledge, ...
who wrote the early algebraic treatise
Al-Jabr ''The Concise Book of Calculation by Restoration and Balancing'' (, ;} or ), commonly abbreviated ''Al-Jabr'' or ''Algebra'' (Arabic: ), is an Arabic mathematical treatise on algebra written in Baghdad around 820 by the Persian polymath Al-Khw ...
, used the technique of completing the square to solve quadratic equations.


Overview


Background

The formula 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 ...
for computing the
square In geometry, a square is a regular polygon, regular quadrilateral. It has four straight sides of equal length and four equal angles. Squares are special cases of rectangles, which have four equal angles, and of rhombuses, which have four equal si ...
of a
binomial Binomial may refer to: In mathematics *Binomial (polynomial), a polynomial with two terms *Binomial coefficient, numbers appearing in the expansions of powers of binomials *Binomial QMF, a perfect-reconstruction orthogonal wavelet decomposition * ...
is: (x + p)^2 \,=\, x^2 + 2px + p^2. For example: \begin (x+3)^2 \,&=\, x^2 + 6x + 9 && (p=3)\\ pt(x-5)^2 \,&=\, x^2 - 10x + 25\qquad && (p=-5). \end In any perfect square, the
coefficient In mathematics, a coefficient is a Factor (arithmetic), multiplicative factor involved in some Summand, term of a polynomial, a series (mathematics), series, or any other type of expression (mathematics), expression. It may be a Dimensionless qu ...
of ''x'' is twice the number ''p'', and the
constant term In mathematics, a constant term (sometimes referred to as a free term) is a term in an algebraic expression that does not contain any variables and therefore is constant. For example, in the quadratic polynomial, :x^2 + 2x + 3,\ The number 3 i ...
is equal to ''p''2.


Basic example

Consider the following quadratic
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 ...
: x^2 + 10x + 28. This quadratic is not a perfect square, since 28 is not the square of 5: (x+5)^2 \,=\, x^2 + 10x + 25. However, it is possible to write the original quadratic as the sum of this square and a constant: x^2 + 10x + 28 \,=\, (x+5)^2 + 3. This is called completing the square.


General description

Given any monic quadratic x^2 + bx + c, it is possible to form a square that has the same first two terms: \left(x+\tfrac b\right)^2 \,=\, x^2 + bx + \tfracb^2. This square differs from the original quadratic only in the value of the constant term. Therefore, we can write x^2 + bx + c \,=\, \left(x + \tfracb\right)^2 + k, where k = c - \frac. This operation is known as completing the square. For example: \begin x^2 + 6x + 11 \,&=\, (x+3)^2 + 2 \\ ptx^2 + 14x + 30 \,&=\, (x+7)^2 - 19 \\ ptx^2 - 2x + 7 \,&=\, (x-1)^2 + 6. \end


Non-monic case

Given a quadratic polynomial of the form ax^2 + bx + c it is possible to factor out the coefficient ''a'', and then complete the square for the resulting
monic polynomial In algebra, a monic polynomial is a non-zero univariate polynomial (that is, a polynomial in a single variable) in which the leading coefficient (the nonzero coefficient of highest degree) is equal to 1. That is to say, a monic polynomial is one ...
. Example: \begin 3x^2 + 12x + 27 &= 3 ^2+4x+9\ &= 3\left x+2)^2 + 5\right\ &= 3(x+2)^2 + 3(5)\\ &= 3(x+2)^2 + 15 \end This process of factoring out the coefficient ''a'' can further be simplified by only factorising it out of the first 2 terms. The integer at the end of the polynomial does not have to be included. Example: \begin 3x^2 + 12x + 27 &= 3\left ^2+4x\right+ 27\\ ex &= 3\left x+2)^2 -4\right+ 27\\ ex &= 3(x+2)^2 + 3(-4) + 27\\ ex &= 3(x+2)^2 - 12 + 27\\ ex &= 3(x+2)^2 + 15 \end This allows the writing of any quadratic polynomial in the form a(x-h)^2 + k.


Formula


Scalar case

The result of completing the square may be written as a formula. In the general case, one has ax^2 + bx + c = a(x-h)^2 + k, with h = -\frac \quad\text\quad k = c - ah^2 = c - \frac. In particular, when , one has x^2 + bx + c = (x-h)^2 + k, with h = -\frac \quad\text\quad k = c - h^2 = c - \frac. By solving the equation a(x-h)^2 + k=0 in terms of x-h, and reorganizing the resulting expression, one gets the
quadratic formula In elementary algebra, the quadratic formula is a closed-form expression describing the solutions of a quadratic equation. Other ways of solving quadratic equations, such as completing the square, yield the same solutions. Given a general quadr ...
for the roots of the
quadratic equation In mathematics, a quadratic equation () is an equation that can be rearranged in standard form as ax^2 + bx + c = 0\,, where the variable (mathematics), variable represents an unknown number, and , , and represent known numbers, where . (If and ...
: x=\frac.


Matrix case

The
matrix Matrix (: matrices or matrixes) or MATRIX may refer to: Science and mathematics * Matrix (mathematics), a rectangular array of numbers, symbols or expressions * Matrix (logic), part of a formula in prenex normal form * Matrix (biology), the m ...
case looks very similar: x^Ax + x^b + c = (x - h)^A(x - h) + k where h = -\fracA^b and k = c - \frac b^A^b. Note that A has to be
symmetric Symmetry () in everyday life refers to a sense of harmonious and beautiful proportion and balance. In mathematics, the term has a more precise definition and is usually used to refer to an object that is invariant under some transformations ...
. If A is not symmetric the formulae for h and k have to be generalized to: h = -(A+A^)^b \quad\text\quad k = c - h^A h = c - b^ (A+A^)^ A (A+A^)^b


Relation to the graph

In
analytic geometry In mathematics, analytic geometry, also known as coordinate geometry or Cartesian geometry, is the study of geometry using a coordinate system. This contrasts with synthetic geometry. Analytic geometry is used in physics and engineering, and als ...
, the
graph Graph may refer to: Mathematics *Graph (discrete mathematics), a structure made of vertices and edges **Graph theory, the study of such graphs and their properties *Graph (topology), a topological space resembling a graph in the sense of discret ...
of any
quadratic function In mathematics, a quadratic function of a single variable (mathematics), variable is a function (mathematics), function of the form :f(x)=ax^2+bx+c,\quad a \ne 0, where is its variable, and , , and are coefficients. The mathematical expression, e ...
is a
parabola In mathematics, a parabola is a plane curve which is Reflection symmetry, mirror-symmetrical and is approximately U-shaped. It fits several superficially different Mathematics, mathematical descriptions, which can all be proved to define exactl ...
in the ''xy''-plane. Given a quadratic polynomial of the form a(x-h)^2 + k the numbers ''h'' and ''k'' may be interpreted as the
Cartesian coordinates In geometry, a Cartesian coordinate system (, ) in a plane is a coordinate system that specifies each point uniquely by a pair of real numbers called ''coordinates'', which are the signed distances to the point from two fixed perpendicular o ...
of the vertex (or
stationary point In mathematics, particularly in calculus, a stationary point of a differentiable function of one variable is a point on the graph of a function, graph of the function where the function's derivative is zero. Informally, it is a point where the ...
) of the parabola. That is, ''h'' is the ''x''-coordinate of the axis of symmetry (i.e. the axis of symmetry has equation ''x = h''), and ''k'' is the minimum value (or maximum value, if ''a'' < 0) of the quadratic function. One way to see this is to note that the graph of the function is a parabola whose vertex is at the origin (0, 0). Therefore, the graph of the function is a parabola shifted to the right by ''h'' whose vertex is at (''h'', 0), as shown in the top figure. In contrast, the graph of the function is a parabola shifted upward by whose vertex is at , as shown in the center figure. Combining both horizontal and vertical shifts yields is a parabola shifted to the right by and upward by whose vertex is at , as shown in the bottom figure.


Solving quadratic equations

Completing the square may be used to solve any
quadratic equation In mathematics, a quadratic equation () is an equation that can be rearranged in standard form as ax^2 + bx + c = 0\,, where the variable (mathematics), variable represents an unknown number, and , , and represent known numbers, where . (If and ...
. For example: x^2 + 6x + 5 = 0. The first step is to complete the square: (x+3)^2 - 4 = 0. Next we solve for the squared term: (x+3)^2 = 4. Then either x+3 = -2 \quad\text\quad x+3 = 2, and therefore x = -5 \quad\text\quad x = -1. This can be applied to any quadratic equation. When the ''x''2 has a coefficient other than 1, the first step is to divide out the equation by this coefficient: for an example see the non-monic case below.


Irrational and complex roots

Unlike methods involving factoring the equation, which is reliable only if the roots are
rational Rationality is the quality of being guided by or based on reason. In this regard, a person acts rationally if they have a good reason for what they do, or a belief is rational if it is based on strong evidence. This quality can apply to an ...
, completing the square will find the roots of a quadratic equation even when those roots are
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 ...
or
complex Complex commonly refers to: * Complexity, the behaviour of a system whose components interact in multiple ways so possible interactions are difficult to describe ** Complex system, a system composed of many components which may interact with each ...
. For example, consider the equation x^2 - 10x + 18 = 0. Completing the square gives (x-5)^2 - 7 = 0, so (x-5)^2 = 7. Then either x-5 = -\sqrt \quad\text\quad x-5 = \sqrt. In terser language: x-5 = \pm \sqrt, so x = 5 \pm \sqrt. Equations with complex roots can be handled in the same way. For example: \begin x^2 + 4x + 5 &= 0 \\ pt(x+2)^2 + 1 &= 0 \\ pt(x+2)^2 &= -1 \\ ptx+2 &= \pm i \\ ptx &= -2 \pm i. \end


Non-monic case

For an equation involving a non- monic quadratic, the first step to solving them is to divide through by the coefficient of ''x''2. For example: \begin 2x^2 + 7x + 6 \,=\, 0 \\ ptx^2 + \tfracx + 3 \,=\, 0 \\ pt\left(x+\tfrac\right)^2 - \tfrac \,=\, 0 \\ pt\left(x+\tfrac\right)^2 \,=\, \tfrac \\ ptx+\tfrac = \tfrac \quad\text\quad x+\tfrac = -\tfrac \\ ptx = -\tfrac \quad\text\quad x = -2. \end Applying this procedure to the general form of a quadratic equation leads to the
quadratic formula In elementary algebra, the quadratic formula is a closed-form expression describing the solutions of a quadratic equation. Other ways of solving quadratic equations, such as completing the square, yield the same solutions. Given a general quadr ...
.


Other applications


Integration

Completing the square may be used to evaluate any integral of the form \int \frac using the basic integrals \int\frac = \frac\ln\left, \frac\ +C \quad\text\quad \int\frac = \frac\arctan\left(\frac\right) +C. For example, consider the integral \int \frac. Completing the square in the denominator gives: \int \frac \,=\, \int\frac. This can now be evaluated by using the substitution ''u'' = ''x'' + 3, which yields \int\frac \,=\, \frac\arctan\left(\frac\right)+C.


Complex numbers

Consider the expression , z, ^2 - b^*z - bz^* + c, where ''z'' and ''b'' are
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 ...
s, ''z''* and ''b''* are the
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 of ''z'' and ''b'', respectively, and ''c'' is a
real number In mathematics, a real number is a number that can be used to measure a continuous one- dimensional quantity such as a duration or temperature. Here, ''continuous'' means that pairs of values can have arbitrarily small differences. Every re ...
. Using the identity , ''u'', 2 = ''uu''* we can rewrite this as , z-b, ^2 - , b, ^2 + c , which is clearly a real quantity. This is because \begin , z-b, ^2 &= (z-b)(z-b)^*\\ &= (z-b)(z^*-b^*)\\ &= zz^* - zb^* - bz^* + bb^*\\ &= , z, ^2 - zb^* - bz^* + , b, ^2 . \end As another example, the expression ax^2 + by^2 + c , where ''a'', ''b'', ''c'', ''x'', and ''y'' are real numbers, with ''a'' > 0 and ''b'' > 0, may be expressed in terms of the square of the
absolute value In mathematics, the absolute value or modulus of a real number x, is the non-negative value without regard to its sign. Namely, , x, =x if x is a positive number, and , x, =-x if x is negative (in which case negating x makes -x positive), ...
of a complex number. Define z = \sqrt\,x + i \sqrt \,y . Then \begin , z, ^2 &= z z^*\\ ex&= \left(\sqrt\,x + i \sqrt\,y\right) \left(\sqrt\,x - i \sqrt\,y\right) \\ ex&= ax^2 - i\sqrt\,xy + i\sqrt\,yx - i^2 by^2 \\ ex&= ax^2 + by^2 , \end so ax^2 + by^2 + c = , z, ^2 + c .


Idempotent matrix

A
matrix Matrix (: matrices or matrixes) or MATRIX may refer to: Science and mathematics * Matrix (mathematics), a rectangular array of numbers, symbols or expressions * Matrix (logic), part of a formula in prenex normal form * Matrix (biology), the m ...
''M'' is
idempotent Idempotence (, ) is the property of certain operations in mathematics and computer science whereby they can be applied multiple times without changing the result beyond the initial application. The concept of idempotence arises in a number of pl ...
when ''M''2 = ''M''. Idempotent matrices generalize the idempotent properties of 0 and 1. The completion of the square method of addressing the equation a^2 + b^2 = a , shows that some idempotent 2×2 matrices are parametrized by a
circle A circle is a shape consisting of all point (geometry), points in a plane (mathematics), plane that are at a given distance from a given point, the Centre (geometry), centre. The distance between any point of the circle and the centre is cal ...
in the (''a'',''b'')-plane: The matrix \begina & b \\ b & 1-a \end will be idempotent provided a^2 + b^2 = a , which, upon completing the square, becomes (a - \tfrac)^2 + b^2 = \tfrac . In the (''a'',''b'')-plane, this is the equation of a circle with center (1/2, 0) and radius 1/2.


Geometric perspective

Consider completing the square for the equation x^2 + bx = a. Since ''x''2 represents the area of a square with side of length ''x'', and ''bx'' represents the area of a rectangle with sides ''b'' and ''x'', the process of completing the square can be viewed as visual manipulation of rectangles. Simple attempts to combine the ''x''2 and the ''bx'' rectangles into a larger square result in a missing corner. The term (''b''/2)2 added to each side of the above equation is precisely the area of the missing corner, whence derives the terminology "completing the square".


A variation on the technique

As conventionally taught, completing the square consists of adding the third term, ''v'' to u^2 + 2uv to get a square. There are also cases in which one can add the middle term, either 2''uv'' or −2''uv'', to u^2 + v^2 to get a square.


Example: the sum of a positive number and its reciprocal

By writing \begin x + & = \left(x - 2 + \right) + 2\\ &= \left(\sqrt - \right)^2 + 2 \end we show that the sum of a positive number ''x'' and its reciprocal is always greater than or equal to 2. The square of a real expression is always greater than or equal to zero, which gives the stated bound; and here we achieve 2 just when ''x'' is 1, causing the square to vanish.


Example: factoring a simple quartic polynomial

Consider the problem of factoring the polynomial x^4 + 324 . This is (x^2)^2 + (18)^2, so the middle term is 2(''x''2)(18) = 36''x''2. Thus we get \begin x^4 + 324 &= (x^4 + 36x^2 + 324 ) - 36x^2 \\ &= (x^2 + 18)^2 - (6x)^2 =\text \\ &= (x^2 + 18 + 6x)(x^2 + 18 - 6x) \\ &= (x^2 + 6x + 18)(x^2 - 6x + 18) \end (the last line being added merely to follow the convention of decreasing degrees of terms). The same argument shows that x^4 + 4a^4 is always factorizable as x^4 + 4a^4 = \left(x^2+2a x + 2a^2\right) \left(x^2-2 ax + 2a^2\right) (Also known as Sophie Germain's identity).


Completing the cube

"Completing the square" consists to remark that the two first terms of a
quadratic polynomial In mathematics, a quadratic function of a single variable is a function of the form :f(x)=ax^2+bx+c,\quad a \ne 0, where is its variable, and , , and are coefficients. The expression , especially when treated as an object in itself rather tha ...
are also the first terms of the square of a
linear polynomial In mathematics, a polynomial is a mathematical expression consisting of indeterminates (also called variables) and coefficients, that involves only the operations of addition, subtraction, multiplication and exponentiation to nonnegative integer ...
, and to use this for expressing the quadratic polynomial as the sum of a square and a constant. Completing the cube is a similar technique that allows to transform a
cubic polynomial In mathematics, a cubic function is a function (mathematics), function of the form f(x)=ax^3+bx^2+cx+d, that is, a polynomial function of degree three. In many texts, the ''coefficients'' , , , and are supposed to be real numbers, and the func ...
into a cubic polynomial without term of degree two. More precisely, if :ax^3+bx^2+cx+d is a polynomial in such that a\ne 0, its two first terms are the two first terms of the expanded form of :a\left(x+\frac b \right)^3=ax^3+bx^2+x\,\frac+\frac . So, the change of variable :t=x+\frac b provides a cubic polynomial in t without term of degree two, which is called the depressed form of the original polynomial. This transformation is generally the first step of the methods for solving the general cubic equation. More generally, a similar transformation can be used for removing terms of degree n-1 in polynomials of degree n, which is called
Tschirnhaus transformation In mathematics, a Tschirnhaus transformation, also known as Tschirnhausen transformation, is a type of mapping on polynomials developed by Ehrenfried Walther von Tschirnhaus in 1683. Simply, it is a method for transforming a polynomial equation ...
.


References

*Algebra 1, Glencoe, , pages 539–544 *Algebra 2, Saxon, , pages 214–214, 241–242, 256–257, 398–401


External links

*{{PlanetMath , urlname=completingthesquare , title=Completing the square Elementary algebra Articles containing proofs Articles containing video clips