Completing the square
   HOME

TheInfoList



OR:

: In
elementary algebra Elementary algebra encompasses the basic concepts of algebra. It is often contrasted with arithmetic: arithmetic deals with specified numbers, whilst algebra introduces variables (quantities without fixed values). This use of variables entail ...
, completing the square is a technique for converting a
quadratic polynomial In mathematics, a quadratic polynomial is a polynomial of degree two in one or more variables. A quadratic function is the polynomial function defined by a quadratic polynomial. Before 20th century, the distinction was unclear between a polynomial ...
of the form :ax^2 + bx + c to the form :a(x-h)^2 + k for some values of ''h'' and ''k''. In other words, completing the square places a perfect square trinomial inside of a quadratic expression. Completing the square is used in * solving
quadratic equation In algebra, a quadratic equation () is any equation that can be rearranged in standard form as ax^2 + bx + c = 0\,, where represents an unknown value, and , , and represent known numbers, where . (If and then the equation is linear, not qu ...
s, * deriving the
quadratic formula In elementary algebra, the quadratic formula is a formula that provides the solution(s) to a quadratic equation. There are other ways of solving a quadratic equation instead of using the quadratic formula, such as factoring (direct factoring, ...
, * graphing
quadratic function In mathematics, a quadratic polynomial is a polynomial of degree two in one or more variables. A quadratic function is the polynomial function defined by a quadratic polynomial. Before 20th century, the distinction was unclear between a polynomia ...
s, * evaluating
integral In mathematics, an integral assigns numbers to functions in a way that describes displacement, area, volume, and other concepts that arise by combining infinitesimal data. The process of finding integrals is called integration. Along with ...
s in calculus, such as
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, * finding
Laplace transform In mathematics, the Laplace transform, named after its discoverer Pierre-Simon Laplace (), is an integral transform that converts a function of a real variable (usually t, in the '' time domain'') to a function of a complex variable s (in the ...
s. In mathematics, completing the square is often applied in any computation involving quadratic polynomials.


History

Completing the square was known in the
Old Babylonian Empire The Old Babylonian Empire, or First Babylonian Empire, is dated to BC – BC, 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 ...
.
Muhammad ibn Musa Al-Khwarizmi Muḥammad ibn Mūsā al-Khwārizmī ( ar, محمد بن موسى الخوارزمي, Muḥammad ibn Musā al-Khwārazmi; ), or al-Khwarizmi, was a Persians, Persian polymath from Khwarazm, who produced vastly influential works in Mathematics ...
, a famed
polymath A polymath ( el, πολυμαθής, , "having learned much"; la, homo universalis, "universal human") is an individual whose knowledge spans a substantial number of subjects, known to draw on complex bodies of knowledge to solve specific pro ...
who wrote the early
algebraic Algebraic may refer to any subject related to algebra in mathematics and related branches like algebraic number theory and algebraic topology. The word algebra itself has several meanings. Algebraic may also refer to: * Algebraic data type, a data ...
treatise
Al-Jabr ''The Compendious Book on Calculation by Completion and Balancing'' ( ar, كتاب المختصر في حساب الجبر والمقابلة, ; la, Liber Algebræ et Almucabola), also known as ''Al-Jabr'' (), is an Arabic mathematical treati ...
, used the technique of completing the square to solve quadratic equations.


Overview


Background

The formula in
elementary algebra Elementary algebra encompasses the basic concepts of algebra. It is often contrasted with arithmetic: arithmetic deals with specified numbers, whilst algebra introduces variables (quantities without fixed values). This use of variables entail ...
for computing the
square In Euclidean geometry, a square is a regular quadrilateral, which means that it has four equal sides and four equal angles (90- degree angles, π/2 radian angles, or right angles). It can also be defined as a rectangle with two equal-length a ...
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 multiplicative factor in some term of a polynomial, a series, or an expression; it is usually a number, but may be any expression (including variables such as , and ). When the coefficients are themselves ...
of ''x'' is twice the number ''p'', and the
constant term In mathematics, a constant 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 3 is a constant term. After like terms are com ...
is equal to ''p''2.


Basic example

Consider the following quadratic
polynomial In mathematics, a polynomial is an expression consisting of indeterminates (also called variables) and coefficients, that involves only the operations of addition, subtraction, multiplication, and positive-integer powers of variables. An exampl ...
: :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 single-variable polynomial (that is, a univariate polynomial) in which the leading coefficient (the nonzero coefficient of highest degree) is equal to 1. Therefore, a monic polynomial has the form: :x^n+c_x^+\ ...
. 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 ^2+4x+ 27\\ &= 3\left x+2)^2 -4\right+ 27\\ &= 3(x+2)^2 + 3(-4) + 27\\ &= 3(x+2)^2 - 12 + 27\\ &= 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
Section ''Formula for the Vertex of a Quadratic Function'', page 133–134, figure 2.4.8
: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 formula that provides the solution(s) to a quadratic equation. There are other ways of solving a quadratic equation instead of using the quadratic formula, such as factoring (direct factoring, ...
for the roots of the
quadratic equation In algebra, a quadratic equation () is any equation that can be rearranged in standard form as ax^2 + bx + c = 0\,, where represents an unknown value, and , , and represent known numbers, where . (If and then the equation is linear, not qu ...
: :x=\frac.


Matrix case

The
matrix Matrix most commonly refers to: * ''The Matrix'' (franchise), an American media franchise ** '' The Matrix'', a 1999 science-fiction action film ** "The Matrix", a fictional setting, a virtual reality environment, within ''The Matrix'' (franchi ...
case looks very similar: :x^Ax + x^b + c = (x - h)^A(x - h) + k \quad\text\quad h = -\fracA^b \quad\text\quad k = c - \fracb^A^b where A has to be symmetric. 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 classical 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 enginee ...
, 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 discre ...
of any
quadratic function In mathematics, a quadratic polynomial is a polynomial of degree two in one or more variables. A quadratic function is the polynomial function defined by a quadratic polynomial. Before 20th century, the distinction was unclear between a polynomia ...
is a
parabola In mathematics, a parabola is a plane curve which is mirror-symmetrical and is approximately U-shaped. It fits several superficially different mathematical descriptions, which can all be proved to define exactly the same curves. One descri ...
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 A Cartesian coordinate system (, ) in a plane is a coordinate system that specifies each point uniquely by a pair of numerical coordinates, which are the signed distances to the point from two fixed perpendicular oriented lines, measured in ...
of the
vertex Vertex, vertices or vertexes may refer to: Science and technology Mathematics and computer science *Vertex (geometry), a point where two or more curves, lines, or edges meet *Vertex (computer graphics), a data structure that describes the position ...
(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 the function where the function's derivative is zero. Informally, it is a point where the function "stops" in ...
) 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 ''ƒ''(''x'') = ''x''2 is a parabola whose vertex is at the origin (0, 0). Therefore, the graph of the function ''ƒ''(''x'' − ''h'') = (''x'' − ''h'')2 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 ''ƒ''(''x'') + ''k'' = ''x''2 + ''k'' is a parabola shifted upward by ''k'' whose vertex is at (0, ''k''), as shown in the center figure. Combining both horizontal and vertical shifts yields ''ƒ''(''x'' − ''h'') + ''k'' = (''x'' − ''h'')2 + ''k'' is a parabola shifted to the right by ''h'' and upward by ''k'' whose vertex is at (''h'', ''k''), as shown in the bottom figure.


Solving quadratic equations

Completing the square may be used to solve any
quadratic equation In algebra, a quadratic equation () is any equation that can be rearranged in standard form as ax^2 + bx + c = 0\,, where represents an unknown value, and , , and represent known numbers, where . (If and then the equation is linear, not qu ...
. 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 reasons. 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 abi ...
, 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 inclusion of rationality. It is more specifically described as an action or opinion given through inadequate use of reason, or through emotional distress or cognitive deficiency. T ...
or complex. 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 formula that provides the solution(s) to a quadratic equation. There are other ways of solving a quadratic equation instead of using the quadratic formula, such as factoring (direct factoring, ...
.


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 Substitution may refer to: Arts and media *Chord substitution, in music, swapping one chord for a related one within a chord progression *Substitution (poetry), a variation in poetic scansion * "Substitution" (song), a 2009 song by Silversun Pic ...
''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 fo ...
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, then) the complex conjugate of a + bi is equal to 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 distance, duration or temperature. Here, ''continuous'' means that values can have arbitrarily small variations. Every ...
. 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 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^*\\ &= (\sqrt\,x + i \sqrt\,y)(\sqrt\,x - i \sqrt\,y) \\ &= ax^2 - i\sqrt\,xy + i\sqrt\,yx - i^2by^2 \\ &= ax^2 + by^2 , \end so : ax^2 + by^2 + c = , z, ^2 + c .


Idempotent matrix

A
matrix Matrix most commonly refers to: * ''The Matrix'' (franchise), an American media franchise ** '' The Matrix'', a 1999 science-fiction action film ** "The Matrix", a fictional setting, a virtual reality environment, within ''The Matrix'' (franchi ...
''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 points in a plane that are at a given distance from a given point, the centre. Equivalently, it is the curve traced out by a point that moves in a plane so that its distance from a given point is cons ...
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'' 2 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 =(x^2+2a x + 2a^2)(x^2-2 ax + 2a^2) (Also known as Sophie Germain's identity).


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