Английская Википедия:Completing the square

Материал из Онлайн справочника
Перейти к навигацииПерейти к поиску

Шаблон:Short description

Файл:Completing the square.ogv
Animation depicting the process of completing the square. (Details, animated GIF version)

In elementary algebra, completing the square is a technique for converting a quadratic polynomial of the form <math display="block">ax^2 + bx + c</math> to the form <math display="block">a(x-h)^2 + k</math> 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

In mathematics, completing the square is often applied in any computation involving quadratic polynomials.

History

Шаблон:Further The technique of completing the square was known in the Old Babylonian Empire.[4]

Muhammad ibn Musa Al-Khwarizmi, a famous polymath who wrote the early algebraic treatise Al-Jabr, used the technique of completing the square to solve quadratic equations.[5]

Overview

Background

The formula in elementary algebra for computing the square of a binomial is: <math display="block">(x + p)^2 \,=\, x^2 + 2px + p^2.</math>

For example: <math display="block">\begin{alignat}{2} (x+3)^2 \,&=\, x^2 + 6x + 9 && (p=3)\\[3pt] (x-5)^2 \,&=\, x^2 - 10x + 25\qquad && (p=-5). \end{alignat} </math>

In any perfect square, the coefficient of x is twice the number p, and the constant term is equal to p2.

Basic example

Consider the following quadratic polynomial: <math display="block">x^2 + 10x + 28.</math>

This quadratic is not a perfect square, since 28 is not the square of 5: <math display="block">(x+5)^2 \,=\, x^2 + 10x + 25.</math>

However, it is possible to write the original quadratic as the sum of this square and a constant: <math display="block">x^2 + 10x + 28 \,=\, (x+5)^2 + 3.</math>

This is called completing the square.

General description

Given any monic quadratic <math display="block">x^2 + bx + c,</math> it is possible to form a square that has the same first two terms: <math display="block">\left(x+\tfrac{1}{2} b\right)^2 \,=\, x^2 + bx + \tfrac{1}{4}b^2.</math>

This square differs from the original quadratic only in the value of the constant term. Therefore, we can write <math display="block">x^2 + bx + c \,=\, \left(x + \tfrac{1}{2}b\right)^2 + k,</math> where <math>k = c - \frac{b^2}{4}</math>. This operation is known as completing the square. For example: <math display="block">\begin{alignat}{1} x^2 + 6x + 11 \,&=\, (x+3)^2 + 2 \\[3pt] x^2 + 14x + 30 \,&=\, (x+7)^2 - 19 \\[3pt] x^2 - 2x + 7 \,&=\, (x-1)^2 + 6. \end{alignat} </math>

Non-monic case

Given a quadratic polynomial of the form <math display="block">ax^2 + bx + c</math> it is possible to factor out the coefficient a, and then complete the square for the resulting monic polynomial.

Example: <math display="block"> \begin{align}

 3x^2 + 12x + 27 &= 3[x^2+4x+9]\\
         &{}= 3\left[(x+2)^2 + 5\right]\\
         &{}= 3(x+2)^2 + 3(5)\\
         &{}= 3(x+2)^2 + 15

\end{align}</math> 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: <math display="block"> \begin{align}

 3x^2 + 12x + 27 &= 3\left[x^2+4x\right] + 27\\[1ex]
         &{}= 3\left[(x+2)^2 -4\right] + 27\\[1ex]
         &{}= 3(x+2)^2 + 3(-4) + 27\\[1ex]
         &{}= 3(x+2)^2 - 12 + 27\\[1ex]
         &{}= 3(x+2)^2 + 15

\end{align}</math>

This allows the writing of any quadratic polynomial in the form <math display="block">a(x-h)^2 + k.</math>

Formula

Scalar case

The result of completing the square may be written as a formula. In the general case, one has[6] <math display="block">ax^2 + bx + c = a(x-h)^2 + k,</math> with <math display="block">h = -\frac{b}{2a} \quad\text{and}\quad k = c - ah^2 = c - \frac{b^2}{4a}.</math>

In particular, when Шаблон:Math, one has <math display="block">x^2 + bx + c = (x-h)^2 + k,</math> with <math display="block">h = -\frac{b}{2} \quad\text{and}\quad k = c - h^2 = c - \frac{b^2}{4}.</math>

By solving the equation <math>a(x-h)^2 + k=0</math> in terms of <math>x-h,</math> and reorganizing the resulting expression, one gets the quadratic formula for the roots of the quadratic equation: <math display="block">x=\frac{-b \pm \sqrt{b^2-4ac}}{2a}.</math>

Matrix case

The matrix case looks very similar: <math display="block">x^{\mathrm{T}}Ax + x^{\mathrm{T}}b + c = (x - h)^{\mathrm{T}}A(x - h) + k </math> where <math display="inline"> h = -\frac{1}{2}A^{-1}b </math> and <math display="inline"> k = c - \frac{1}{4} b^{\mathrm{T}}A^{-1}b</math>. Note that <math>A</math> has to be symmetric.

If <math>A</math> is not symmetric the formulae for <math>h</math> and <math>k</math> have to be generalized to: <math display="block">h = -(A+A^{\mathrm{T}})^{-1}b \quad\text{and}\quad k = c - h^{\mathrm{T}}A h = c - b^{\mathrm{T}} (A+A^{\mathrm{T}})^{-1} A (A+A^{\mathrm{T}})^{-1}b</math>

Relation to the graph

Шаблон:Multiple image In analytic geometry, the graph of any quadratic function is a parabola in the xy-plane. Given a quadratic polynomial of the form <math display="block">a(x-h)^2 + k</math> the numbers h and k may be interpreted as the Cartesian coordinates of the vertex (or stationary point) 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 Шаблон:Math is a parabola whose vertex is at the origin (0, 0). Therefore, the graph of the function Шаблон:Math 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 Шаблон:Math is a parabola shifted upward by Шаблон:Mvar whose vertex is at Шаблон:Math, as shown in the center figure. Combining both horizontal and vertical shifts yields Шаблон:Math is a parabola shifted to the right by Шаблон:Mvar and upward by Шаблон:Mvar whose vertex is at Шаблон:Math, as shown in the bottom figure.

Solving quadratic equations

Completing the square may be used to solve any quadratic equation. For example: <math display="block">x^2 + 6x + 5 = 0.</math>

The first step is to complete the square: <math display="block">(x+3)^2 - 4 = 0.</math>

Next we solve for the squared term: <math display="block">(x+3)^2 = 4.</math>

Then either <math display="block">x+3 = -2 \quad\text{or}\quad x+3 = 2,</math> and therefore <math display="block">x = -5 \quad\text{or}\quad x = -1.</math>

This can be applied to any quadratic equation. When the x2 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, completing the square will find the roots of a quadratic equation even when those roots are irrational or complex. For example, consider the equation <math display="block">x^2 - 10x + 18 = 0.</math>

Completing the square gives <math display="block">(x-5)^2 - 7 = 0,</math> so <math display="block">(x-5)^2 = 7.</math> Then either <math display="block">x-5 = -\sqrt{7} \quad\text{or}\quad x-5 = \sqrt{7}.</math>

In terser language: <math display="block">x-5 = \pm \sqrt{7},</math> so <math display="block">x = 5 \pm \sqrt{7}.</math>

Equations with complex roots can be handled in the same way. For example: <math display="block">\begin{align} x^2 + 4x + 5 &= 0 \\[6pt] (x+2)^2 + 1 &= 0 \\[6pt] (x+2)^2 &= -1 \\[6pt] x+2 &= \pm i \\[6pt] x &= -2 \pm i. \end{align}</math>

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 x2. For example:

<math display="block">\begin{array}{c} 2x^2 + 7x + 6 \,=\, 0 \\[6pt] x^2 + \tfrac{7}{2}x + 3 \,=\, 0 \\[6pt] \left(x+\tfrac{7}{4}\right)^2 - \tfrac{1}{16} \,=\, 0 \\[6pt] \left(x+\tfrac{7}{4}\right)^2 \,=\, \tfrac{1}{16} \\[6pt] x+\tfrac{7}{4} = \tfrac{1}{4} \quad\text{or}\quad x+\tfrac{7}{4} = -\tfrac{1}{4} \\[6pt] x = -\tfrac{3}{2} \quad\text{or}\quad x = -2. \end{array} </math>

Applying this procedure to the general form of a quadratic equation leads to the quadratic formula.

Other applications

Integration

Completing the square may be used to evaluate any integral of the form <math display="block">\int \frac{dx}{ax^2+bx+c}</math> using the basic integrals <math display="block">\int\frac{dx}{x^2 - a^2} = \frac{1}{2a}\ln\left|\frac{x-a}{x+a}\right| +C \quad\text{and}\quad \int\frac{dx}{x^2 + a^2} = \frac{1}{a}\arctan\left(\frac{x}{a}\right) +C.</math>

For example, consider the integral <math display="block">\int \frac{dx}{x^2 + 6x + 13}.</math>

Completing the square in the denominator gives: <math display="block">\int \frac{dx}{(x+3)^2 + 4} \,=\, \int\frac{dx}{(x+3)^2 + 2^2}.</math>

This can now be evaluated by using the substitution u = x + 3, which yields <math display="block">\int\frac{dx}{(x+3)^2 + 4} \,=\, \frac{1}{2}\arctan\left(\frac{x+3}{2}\right)+C.</math>

Complex numbers

Consider the expression <math display="block"> |z|^2 - b^*z - bz^* + c,</math> 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 <math display="block"> |z-b|^2 - |b|^2 + c , </math> which is clearly a real quantity. This is because <math display="block">\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}</math>

As another example, the expression <math display="block">ax^2 + by^2 + c ,</math> 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 <math display="block">z = \sqrt{a}\,x + i \sqrt{b} \,y .</math>

Then <math display="block">\begin{align} |z|^2 &{}= z z^*\\[1ex] &{}= \left(\sqrt{a}\,x + i \sqrt{b}\,y\right) \left(\sqrt{a}\,x - i \sqrt{b}\,y\right) \\[1ex] &{}= ax^2 - i\sqrt{ab}\,xy + i\sqrt{ba}\,yx - i^2 by^2 \\[1ex] &{}= ax^2 + by^2 , \end{align}</math> so <math display="block"> ax^2 + by^2 + c = |z|^2 + c . </math>

Idempotent matrix

A matrix M is idempotent when M2 = M. Idempotent matrices generalize the idempotent properties of 0 and 1. The completion of the square method of addressing the equation <math display="block">a^2 + b^2 = a ,</math> shows that some idempotent 2×2 matrices are parametrized by a circle in the (a,b)-plane:

The matrix <math>\begin{pmatrix}a & b \\ b & 1-a \end{pmatrix}</math> will be idempotent provided <math>a^2 + b^2 = a ,</math> which, upon completing the square, becomes <math display="block">(a - \tfrac{1}{2})^2 + b^2 = \tfrac{1}{4} .</math> In the (a,b)-plane, this is the equation of a circle with center (1/2, 0) and radius 1/2.

Geometric perspective

Файл:Completing the square.svg

Шаблон:Unsourced Consider completing the square for the equation <math display="block">x^2 + bx = a.</math>

Since x2 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 x2 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Шаблон:I sup to <math display="block">u^2 + 2uv</math> to get a square. There are also cases in which one can add the middle term, either 2uv or −2uv, to <math display="block">u^2 + v^2</math> to get a square.

Example: the sum of a positive number and its reciprocal

By writing <math display="block">\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}</math> 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 <math display="block">x^4 + 324 . </math>

This is <math display="block">(x^2)^2 + (18)^2, </math> so the middle term is 2(x2)(18) = 36x2. Thus we get <math display="block">\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}</math> (the last line being added merely to follow the convention of decreasing degrees of terms).

The same argument shows that <math>x^4 + 4a^4 </math> is always factorizable as <math display="block">x^4 + 4a^4 = \left(x^2+2a x + 2a^2\right) \left(x^2-2 ax + 2a^2\right)</math> (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 are also the first terms of the square of a linear polynomial, 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 into a cubic polynomial without term of degree two.

More precisely, if

<math>ax^3+bx^2+cx+d</math>

is a polynomial in Шаблон:Mvar such that <math>a\ne 0,</math> its two first terms are the two first terms of the expanded form of

<math>a\left(x+\frac b {3a}\right)^3=ax^3+bx^2+x\,\frac{b^2}{3a}+\frac {b^3}{27a^2}.</math>

So, the change of variable

<math>t=x+\frac b {3a}</math>

provides a cubic polynomial in <math>t</math> without term of degree two, which is called the depressed form of the original polynomial.

This transformation is generally the first step of the mehods for solving the general cubic equation.

More generally, a similar transformation can be used for removing terms of degree <math>n-1</math> in polynomials of degree <math>n.</math>

References

Шаблон:Reflist

External links

Шаблон:Commons category