## Completing the square solver

## Answers to Questions

### What is a square completion? (Definition)

**Completion of the square** is the name given to a method of factorization of the polynomials due to this degree. Factoring takes its name from the fact that the factored form obtained has the variable in a squared expression.

### How to complete the square?

dCode can **complete the square** and find factors by depressing a polynomial expression

A polynomial \( x^2 +bx + c = 0 \) can be modified in \( (b/2)^2 - c - (b/2)^2 + c (= 0) \) that allows factorizing in $$ (x +(b/2))^2 - (b/2)^2 + c $$

Example: \( p(x)=2x^2+12x+14 \), in order to **complete the square** hand, factorize the coefficient of \( x^2 \) : \( p(x)=2(x^2+6x+7) \) and continue with \( q(x) = x^2+6x+7 \)

Example: Identify the coefficient of \( x \), here \( 6 \) and divide it by \( 2 \) to get \( β=6/2=3 \) and use \( β \) to write $$ q(x) = x^2 + 6x + 7 = (x+3)^2 − β^2 + 7 = (x+3)^2 − 2 $$

Example: Back to \( p(x) = 2q(x) \) to get the **completed square**: $$ p(x)=2x^2+12x+14=2((x+3)^2−2)=2(x+3)^2−6 $$

With the factorized form, it becomes simple to find the roots.

$$ p(x) = 0 \iff 2(x+3)^2−6 = 0 \iff (x+3)^2 = 3 \\ \iff x+3 = \pm \sqrt{3} \iff x = \pm \sqrt{3} - 3 $$

dCode can generalize the approach to other polynomials of order \( n \) superior to 2 by removing the term of degree \( n-1 \).

## Source code

dCode retains ownership of the source code of the script Completing the Square online. Except explicit open source licence (indicated Creative Commons / free), any algorithm, applet, snippet, software (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or any function (convert, solve, decrypt, encrypt, decipher, cipher, decode, code, translate) written in any informatic langauge (PHP, Java, C#, Python, Javascript, Matlab, etc.) which dCode owns rights will not be given for free. To download the online Completing the Square script for offline use on PC, iPhone or Android, ask for price quote on contact page !