randRangeNonZero(-10, 10) randRangeNonZero(-10, 10)
randRange(1, 6)
SQUARE * A * B A * B SQUARE * (-A - B) -A - B

Solve for x:

plus(SQUARE + "x^2") + plus(LINEAR + "x") + CONSTANT = 0

A
B
x = {} or x = {}

The two numbers -A and -B satisfy both conditions:

\qquad \color{PINK}{-A} + \color{PINK}{-B} = \color{GREEN}{SIMPLELINEAR}

\qquad \color{PINK}{-A} \times \color{PINK}{-B} = \color{BLUE}{SIMPLECONSTANT}

(x A < 0 ? "+" : "" \color{PINK}{-A}) (x B < 0 ? "+" : "" \color{PINK}{-B}) = 0

Since the following equation is true we know that one or both quantities must equal zero. (x A < 0 ? "+" : "" -A) (x B < 0 ? "+" : "" -B) = 0

x + -A = 0 or x + -B = 0

Thus, x = A and x = B are the solutions.

SQUARE * A * A A * A SQUARE * -2 * A -2 * A

Solve for x:

plus( SQUARE + "x^2") + plus( LINEAR + "x" ) + CONSTANT = 0

x = {}A

The number -A used twice satisfies both conditions:

\qquad \color{PINK}{-A} + \color{PINK}{-A} = \color{GREEN}{SIMPLELINEAR}

\qquad \color{PINK}{-A} \times \color{PINK}{-A} = \color{BLUE}{SIMPLECONSTANT}

So (x + \color{PINK}{-A})^2 = 0.

So (x - \color{PINK}{A})^2 = 0.

x + -A = 0

Thus, x = A is the solution.

Dividing both sides by SQUARE gives:

\qquad x^2 SIMPLELINEAR >= 0 ? "+" : "" plus( "\\color{" + GREEN + "}{" + SIMPLELINEAR + "}x" ) SIMPLECONSTANT >= 0 ? "+" : "" plus( "\\color{" + BLUE + "}{" + SIMPLECONSTANT + "}" ) = 0

The coefficient on the x term is SIMPLELINEAR and the constant term is SIMPLECONSTANT, so we need to find two numbers that add up to SIMPLELINEAR and multiply to SIMPLECONSTANT.