# Khan/khan-exercises

Switch branches/tags
Nothing to show
Fetching contributors…
Cannot retrieve contributors at this time
113 lines (104 sloc) 5.5 KB
randRangeNonZero( -10, 10 ) randRangeNonZero( -10, 10 )
1
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 = {} and 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

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:

x^2 + plus(SIMPLELINEAR + "x") + 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.