randRange( 1, 4 ) / randRangeNonZero( -2, 2 ) ( randRange( -3, 3 ) * 2 + 1 ) / 2 ( X1 + X2 ) * -1 B > 0 ? "+" : "-" X1 * X2 getLCM( toFraction( B )[1], toFraction( C )[1] ) new Polynomial( 0, 2, [MULT*C, MULT*B, MULT], "x" ) POLY.text() $._("or")

Complete the square to solve for x.

POLY_TEXT = 0

B / 2 C * -1 + pow( B / 2, 2 ) X1 X2
B / 2 C * -1 + pow( B / 2, 2 ) X2 X1
Completed Square:
(x + {} )^2 = {}

Solution:
x = {}\quad\text{OR}\quad x = {}
( randRange( -4, 4 ) * 2 + 1 ) / 2 X1

Completed Square:
(x + {}-X1 )^2 = {} 0

Solution:
x = \quadX1

randRangeNonZero( -8, 8 ) randRange( -4, 4 ) * 2 + ( X1 % 2 - 1 )

First, divide the polynomial by MULT, the coefficient of the x^2 term.

x^2 + decimalFraction( B, 1, 1 )B_SIGNx + decimalFraction( C, 1, 1 ) = 0

Move the constant term to the right side of the equation.

x^2 + decimalFraction( B, 1, 1 )B_SIGNx = decimalFraction( C * -1, 1, 1 )

We complete the square by taking half of the coefficient of our x term, squaring it, and adding it to both sides of the equation. The coefficient of our x term is decimalFraction( B, 1, 1 ), so half of it would be decimalFraction( B / 2, 1, 1 ), and squaring it gives us \color{blue}{decimalFraction( pow( B / 2, 2 ), 1, 1 )}.

x^2 + decimalFraction( B, 1, 1 )B_SIGNx \color{blue}{ + decimalFraction( pow( B / 2, 2 ), 1, 1 )} = decimalFraction( C * -1, 1, 1 ) \color{blue}{ + decimalFraction( pow( B / 2, 2 ), 1, 1 )}

We can now rewrite the left side of the equation as a squared term.

( x + decimalFraction( B / 2, 1, 1 ) )^2 = decimalFraction( C * -1 + pow( B / 2, 2 ), 1, 1 )

Note that the left side of the equation is already a perfect square trinomial. The coefficient of our x term is decimalFraction( B, 1, 1 ), half of it is decimalFraction( B / 2, 1, 1 ), and squaring it gives us \color{blue}{decimalFraction( pow( B / 2, 2 ), 1, 1 )}, our constant term.

Thus, we can rewrite the left side of the equation as a squared term.

( x + decimalFraction( B / 2, 1, 1 ) )^2 = decimalFraction( C * -1 + pow( B / 2, 2 ), 1, 1 )

Take the square root of both sides.

x + decimalFraction( B / 2, 1, 1 ) = \pmdecimalFraction( sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )

Isolate x to find the solution(s).

x = decimalFraction( -B / 2, 1, 1 )\pmdecimalFraction( sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )

The solutions are: x = decimalFraction( -B / 2 + sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 ) \text{ OR } x = decimalFraction( -B / 2 - sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )

The solution is: x = decimalFraction( -B / 2 + sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )

We already found the completed square: ( x + decimalFraction( B / 2, 1, 1 ) )^2 = decimalFraction( C * -1 + pow( B / 2, 2 ), 1, 1 )