# Khan/khan-exercises

Fetching contributors…
Cannot retrieve contributors at this time
160 lines (153 sloc) 7.7 KB
 Converting between slope-intercept and standard form
randRangeNonZero( -5, 5 ) randRangeNonZero( -5, 5 ) randRangeNonZero( -5, 5 ) -1 * A / B C / B

Convert the following equation from standard form to slope intercept form.

In other words, if the equation is rewritten to look like y = mx + b, what are the values of m and b?

expr([ "*", A, "x"]) + expr([ "*", B, "y" ]) = C

m = SLOPE

b = Y_INTERCEPT

Move the x term to the other side of the equation.

expr([ "*", B, "y" ]) = expr([ "*", -1 * A, "x"]) + C

Divide both sides by B.

y = fractionReduce( -1 * A, B)-x + fractionReduce( C, B )

Inspecting the equation in slope intercept form, we see the following.

\begin{align*}m &= fractionReduce( -1 * A, B)\\ b &= fractionReduce( C, B )\end{align*}

Behold! The magic of math, that both equations could represent the same line!

graphInit({ range: 10, scale: 20, axisArrows: "<->", tickStep: 1, labelStep: 1 }); style({ stroke: BLUE, fill: BLUE }); plot(function( x ) { return x * SLOPE + Y_INTERCEPT; }, [ -10, 10 ]);
randRange(-5, 5) randRangeNonZero(-5, 5) randRange(1, 5) -A / B C / B

Convert the following equation from slope intercept form to standard form.

y = coefficient(fractionReduce(-A, B))x + fractionReduce(C, B)

In other words, what are the values of A, B, and C if the equation is rewritten to look like \blue{A}x + \green{B}y = \pink{C}?

Note that A, B, and C should be integers.

A B C
-A -B -C

A =

B =

C =

Move the x term to the same side as the y term.

coefficient(fractionReduce(A, B))x + y = fractionReduce(C, B)

To get integers, multiply all the terms by B.

coefficient(A)x + By = C

Since the slope is 0 and there is no x term, the equation is already in slope intercept form.

y = Y_INTERCEPT

So we have \blue{A} lot of lots of x, \green{B} lot of lots of y, and a \pink{C}.

\blue{A}x + \green{B}y = \pink{C}

\begin{align*} \blue{A} &= \blue{A}\\ \green{B} &= \green{B}\\ \pink{C} &= \pink{C}\end{align*}

Behold! The magic of math, that both equations could represent the same line!

graphInit({ range: 10, scale: 20, axisArrows: "<->", tickStep: 1, labelStep: 1 }); style({ stroke: BLUE, fill: BLUE }); plot(function( x ) { return x * SLOPE + Y_INTERCEPT; }, [ -10, 10 ]);