Completing the square

From Wikipedia, the free encyclopedia

Completing the square is a technique used in algebra to solve quadratic equations, in analytic geometry for determining the shapes of graphs, and in calculus for computing integrals, including, but hardly limited to, the integrals that define Laplace transforms. The essential objective is to reduce a quadratic polynomial in a variable in an equation or expression to a squared polynomial of linear order. This can reduce an equation or integral to one that is more easily solved or evaluated.

The purpose of completing the square is to fill in the following blank:

ax^2 + bx + c = a(\cdots\cdots)^2 + \mbox{constant}.\,

The expression that will replace the blank depends of course on the variable x. The "constant" does not; that is why it is a "constant".

This amounts to solving the following equation for k1 and k2:

ax^2 + bx + c = a(x + k_1)^2 + k_2\,

where a, b, c are known. This is an identity in x, meaning that it should be true for all x.

Contents

[edit] Overview

In elementary algebra, completing the square is a technique in which an expression involving a quadratic polynomial is transformed to one involving a squared linear polynomial and a constant. It converts a polynomial fragment of the form

a x^2 + b x\,\!

to one of the form

(c x + d)^2 + e\,\!

The coefficients a, b, c, d and e above can be expressions in their own right, containing variables other than x.

Completing the square is commonly used to derive the quadratic formula, which solves a quadratic equation.

\begin{align}   ax^2+bx+c &{}= 0\\   ax^2+bx &{}= -c\\   x^2 + \frac{b}{a} x &{}= -\frac{c}{a}\\   x^2 + \frac{b}{a} x + \left(\frac{b}{2a}\right)^2 &{}= \left(\frac{b}{2a}\right)^2 -\frac{c}{a} &\text{complete the square}\\   \left(x + \frac{b}{2a}\right)^2 &{}=  \frac{b^2-4ac}{4a^2}\\   x + \frac{b}{2a} &{}= \pm\frac{\sqrt{b^2-4ac}}{2a}\\   x &{}= \frac{-b \pm \sqrt{b^2-4ac}}{2a} \end{align}

[edit] General formula

Assume a is positive. To achieve

a x^2 + b x = (c x + d)^2 + e , \,\!

we must set

\begin{align}   c &{}= \sqrt{a} ,\\   d &{}= \frac{b}{2\sqrt{a}} ,\\   e &{}= -d^2\\     &{}= -\left(\frac{b}{2\sqrt{a}}\right)^2\\     &{}= -\frac{b^2}{4a} . \end{align}

This gives

a x^2 + b x = \left(\sqrt{a}\,x + \frac{b}{2 \sqrt{a}}\right)^2 -                      \frac{b^2}{4a} . \,\!

[edit] Examples

[edit] Concrete example

\begin{align}5x^2 + 7x - 6 &{}= 5\left(x^2 + {7 \over 5}x\right) -6 \\ &{}= 5\left(x^2 + {7 \over 5}x +\left({7 \over 10}\right)^2\right) - 6 - 5\left({7 \over 10}\right)^2 \\ &{}= 5\left(x + {7 \over 10}\right)^2 - 6 - {7^2 \over 2\cdot 10}  \\ &{}= 5\left(x + {7 \over 10}\right)^2 - {6\cdot 20 + 7^2 \over 20} \\ &{}= 5\left(x + {7 \over 10}\right)^2 - {169 \over 20}. \end{align}

With this we can find the values of x that produce zero, the roots of the polynomial.

\begin{align} 5x^2 + 7x - 6 &{}= 0\\ 5\left(x + {7 \over 10}\right)^2 - {169 \over 20} &{}= 0\\ \left(x + {7 \over 10}\right)^2 &{}= {169 \over 100}\\ &{}= \left({13 \over 10}\right)^2\\ x + {7 \over 10} &{}= \pm {13 \over 10}\\ x &{}= {-7 \pm 13 \over 10}\\ &{}= {3 \over 5}\mbox{ or }-2. \end{align}

We can also find the x value where the function defined by the polynomial,

y = 5x^2 + 7x - 6 , \,\!

achieves its most extreme values. The highest power, x2, has a positive coefficient, so large positive or negative values of x produce large values of y. Thus the interesting extreme is the minimum value for y. From the squared form,

y = 5\left(x + \frac{7}{10}\right)^2 - \frac{169}{20} ,

we see that if

x = -{7 \over 10} ,

then y = 16920 = 8.45; but if x is any other number, then y is 16920 plus a nonzero square. Since squares of nonzero real numbers are positive, it must be that whenever x is any other number than −710, then y > 8.45. Thus the point (xy) = (−71016920) = (−0.7, 8.45) has the minimum possible value of y.

[edit] Calculus example

Consider the problem of finding this antiderivative:

\int\frac{1}{9x^2-90x+241}\,dx\,\!.

This can be done by completing the square of the denominator. The denominator is

9x^2-90x+241=9(x^2-10x)+241\,\!.

Completing the square by adding (102)2 = 25 to x2−10x gives a perfect square, x2 − 10x + 25 = (x−5)2. The denominator becomes

\begin{align}   9(x^2-10x)+241 &{}=9(x^2-10x+25)+241-9(25)\\                  &{}=9(x-5)^2+16 . \end{align}

So our integral is

\begin{align}   \int\frac{1}{9x^2-90x+241}\,dx &{}=\frac{1}{9}\int\frac{1}{(x-5)^2+(4/3)^2}\,dx\\                               &{}=\frac{1}{9}\cdot\frac{3}{4}\arctan\frac{3(x-5)}{4}+C . \end{align}

The point is that the revised denominator allows us to match a known result from a table of integrals,

\int\frac{1}{u^2+a^2}\,du = \frac{1}{a} \arctan \frac{u}{a} + C .

[edit] Complex number examples

Consider the expression

|z|^2 - b^*z - bz^* + c,\,

where z and b are complex numbers, z* and b* are the complex conjugates of z and b, respectively, and c is a real number. 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{align}   |z-b|^2 &{}=  (z-b)(z-b)^*\\           &{}=  (z-b)(z^*-b^*)\\           &{}= zz^* - zb^* - bz^* + bb^*\\           &{}=  |z|^2 - zb^* - bz^* + |b|^2 . \end{align}

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 of a complex number. Define

z = \sqrt{a}\,x + i \sqrt{b} \,y .

Then

\begin{align}   |z|^2 &{}= z z^*\\         &{}= (\sqrt{a}\,x + i \sqrt{b}\,y)(\sqrt{a}\,x - i \sqrt{b}\,y) \\         &{}= ax^2 - i\sqrt{ab}\,xy + i\sqrt{ba}\,yx - i^2by^2 \\         &{}= ax^2 + by^2 , \end{align}

so

ax^2 + by^2 + c = |z|^2 + c . \,\!

[edit] 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 2uv or −2uv, to

u^2 + v^2\,

to get a square.

[edit] Example: the sum of a positive number and its reciprocal

By writing

\begin{align} x + {1 \over x} &{} = \left(x - 2 + {1 \over x}\right) + 2\\                 &{}= \left(\sqrt{x} - {1 \over \sqrt{x}}\right)^2 + 2 \end{align}

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.

[edit] 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(x2)(18) = 36x2. Thus we get

\begin{align} x^4 + 324 &{}= (x^4 + 36x^2 + 324 ) - 36x^2  \\ &{}= (x^2 + 18)^2 - (6x)^2 =\text{a difference of two squares} \\ &{}= (x^2 + 18 + 6x)(x^2 + 18 - 6x) \\ &{}= (x^2 + 6x + 18)(x^2 - 6x + 18) \end{align}

(the last line being added merely to follow the convention of decreasing degrees of terms).

[edit] External link