Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

141 lines (140 sloc) 10.067 kb
<!DOCTYPE html>
<html data-require="math math-format expressions">
<head>
<meta charset="UTF-8" />
<title>Systems of equations with elimination</title>
<script src="../khan-exercise.js"></script>
<style type="text/css">
#answer_area input[type=text] {
width: 50px;
}
</style>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="X">randRange( 1, 10 )</var>
<var id="Y" data-ensure="X !== Y">randRange( 1, 10 )</var>
<var id="INDEX">randRange( 0, 3 )</var>
<var id="Z1">randRangeWeighted( 1, 3, 1, 0.5 ) * randRangeNonZero( -1, 1 )</var>
<var id="Z2" data-ensure="abs( Z2 ) <= 6 && Z2 !== 0">INDEX === 0 ? -1 * Z1 : randRangeWeighted( -4, 4, -1, 0 ) * Z1</var>
<var id="Z3">randRange( 2, 6 ) * randRangeNonZero( -1, 1 )</var>
<var id="Z4" data-ensure="getGCD( abs( Z3 ), abs( Z4 ) ) === 1">randRange( 2, 6 ) * randRangeNonZero( -1, 1 )</var>
<var id="Z5">randRange( 2, 6 ) * randRangeNonZero( -1, 1 )</var>
<var id="Z6" data-ensure="getGCD( abs( Z5 ), abs( Z6 ) ) === 1 && ( Z3 * Z6 ) !== ( Z4 * Z5 )">randRange( 2, 6 ) * randRangeNonZero( -1, 1 )</var>
</div>
<div class="problems">
<div id="elimination-x">
<div class="vars">
<var id="A1">[ Z1, Z1, Z2, Z5 ][ INDEX ]</var>
<var id="B1">Z3</var>
<var id="C1">A1 * X + B1 * Y</var>
<var id="A2">[ Z2, Z2, Z1, Z6 ][ INDEX ]</var>
<var id="B2">Z4</var>
<var id="C2">A2 * X + B2 * Y</var>
<var id="MULT1">[ 1, -A2 / A1, 1, A2 &gt; 0 &amp;&amp; A1 &lt; 0 ? A2 : -A2 ][ INDEX ]</var>
<var id="MULT2">[ 1, 1, -A1 / A2, A2 &gt; 0 &amp;&amp; A1 &lt; 0 ? -A1 : A1 ][ INDEX ]</var>
<var id="SIGN_1">B1 * Y &gt; 0 ? "-" : "+"</var>
<var id="SIGN_2">B2 * Y &gt; 0 ? "-" : "+"</var>
</div>
<p class="problem">Solve for <code>x</code> and <code>y</code> using elimination.</p>
<div class="question">
<p><code>\color{<var>BLUE</var>}{<var>expr(["+", ["*", A1, "x"], ["*", B1, "y"]])</var> = <var>C1</var>}</code><br />
<code class="hint_green"><var>expr(["+", ["*", A2, "x"], ["*", B2, "y"]])</var> = <var>C2</var></code></p>
</div>
<div class="solution" data-type="multiple">
<p><code>x</code> = <span class="sol"><var>X</var></span></p>
<p><code>y</code> = <span class="sol"><var>Y</var></span></p>
</div>
<div class="hints">
<p>We can eliminate <code>x</code> by adding the equations together when the <code>x</code> coefficients have opposite signs.</p>
<div data-if="INDEX !== 0">
<p>Multiply the <span data-if="INDEX === 2">bottom</span><span data-else>top</span> equation by <span data-if="INDEX === 2"><code><var>MULT2</var></code></span><span data-else><code><var>MULT1</var></code></span><span data-if="INDEX === 3"> and the bottom equation by <code><var>MULT2</var></code></span>.</p>
<p><code>\color{<var>BLUE</var>}{<var>expr(["+", ["*", A1 * MULT1, "x"], ["*", B1 * MULT1, "y"]])</var> = <var>C1 * MULT1</var>}</code><br />
<code class="hint_green"><var>expr(["+", ["*", A2 * MULT2, "x"], ["*", B2 * MULT2, "y"]])</var> = <var>C2 * MULT2</var></code></p>
</div>
<div>
<p>Add the top and bottom equations together.
<p data-if="( B1 * MULT1 + B2 * MULT2 ) !== 1"><code><var>expr(["*", B1 * MULT1 + B2 * MULT2, "y"])</var> = <var>C1 * MULT1 + C2 * MULT2</var></code></p>
<p data-if="( B1 * MULT1 + B2 * MULT2 ) !== 1"><code>\dfrac{<var>expr(["*", B1 * MULT1 + B2 * MULT2, "y"])</var>}{\color{<var>BLUE</var>}{<var>B1 * MULT1 + B2 * MULT2</var>}} = \dfrac{<var>C1 * MULT1 + C2 * MULT2</var>}{\color{<var>BLUE</var>}{<var>B1 * MULT1 + B2 * MULT2</var>}}</code></p>
<p><code>\color{<var>ORANGE</var>}{y = <var>Y</var>}</code></p>
</div>
<div>
<p>Now that you know <code>\color{<var>ORANGE</var>}{y = <var>Y</var>}</code>, plug it back into <code>\thinspace \color{<var>BLUE</var>}{<var>expr(["+", ["*", A1, "x"], ["*", B1, "y"]])</var> = <var>C1</var>}\thinspace</code> to find <code>x</code>.</p>
</div>
<div>
<p><code>\color{<var>BLUE</var>}{<var>expr(["*", A1, "x"])</var> + <span data-if="abs( B1 ) !== 1"><var>B1</var></span><span data-if="B1 === -1">-</span>}\color{<var>ORANGE</var>}{(<var>Y</var>)}\color{<var>BLUE</var>}{= <var>C1</var>}</code></p>
</div>
<div>
<p data-if="B1 !== 1"><code><var>expr(["+", ["*", A1, "x"], B1 * Y])</var> = <var>C1</var></code></p>
<p><code><var>expr(["+", ["*", A1, "x"], B1 * Y])</var>\color{<var>BLUE</var>}{<var>SIGN_1</var><var>abs( B1 * Y )</var>} = <var>C1</var>\color{<var>BLUE</var>}{<var>SIGN_1</var><var>abs( B1 * Y )</var>}</code></p>
<p data-if="A1 !== 1"><code><var>expr(["*", A1, "x"])</var> = <var>C1 - B1 * Y</var></code></p>
<p data-if="A1 !== 1"><code>\dfrac{<var>expr(["*", A1, "x"])</var>}{\color{<var>BLUE</var>}{<var>A1</var>}} = \dfrac{<var>C1 - B1 * Y</var>}{\color{<var>BLUE</var>}{<var>A1</var>}}</code></p>
<p><code>\color{red}{x = <var>X</var>}</code></p>
</div>
<div>
<p>You can also plug <code>\color{<var>ORANGE</var>}{y = <var>Y</var>}</code> into <code>\thinspace \color{<var>GREEN</var>}{<var>expr(["+", ["*", A2, "x"], ["*", B2, "y"]])</var> = <var>C2</var>}\thinspace</code> and get the same answer for <code>x</code>:</p>
<p><code>\color{<var>GREEN</var>}{<var>expr(["*", A2, "x"])</var> + <span data-if="abs( B2 ) !== 1"><var>B2</var></span><span data-if="B2 === -1">-</span>}\color{<var>ORANGE</var>}{(<var>Y</var>)}\color{<var>GREEN</var>}{= <var>C2</var>}</code></p>
<p><code>\color{red}{x = <var>X</var>}</code></p>
</div>
</div>
</div>
<div id="elimination-y">
<div class="vars">
<var id="A1">Z3</var>
<var id="B1">[ Z1, Z1, Z2, Z5 ][ INDEX ]</var>
<var id="C1">A1 * X + B1 * Y</var>
<var id="A2">Z4</var>
<var id="B2">[ Z2, Z2, Z1, Z6 ][ INDEX ]</var>
<var id="C2">A2 * X + B2 * Y</var>
<var id="MULT1">[ 1, -B2 / B1, 1, B2 &gt; 0 &amp;&amp; B1 &lt; 0 ? B2 : -B2 ][ INDEX ]</var>
<var id="MULT2">[ 1, 1, -B1 / B2, B2 &gt; 0 &amp;&amp; B1 &lt; 0 ? -B1 : B1 ][ INDEX ]</var>
<var id="SIGN_1">A1 * X &gt; 0 ? "-" : "+"</var>
<var id="SIGN_2">A2 * X &gt; 0 ? "-" : "+"</var>
</div>
<p class="problem">Solve for <code>x</code> and <code>y</code> using elimination.</p>
<div class="question">
<p><code>\color{<var>BLUE</var>}{<var>expr(["+", ["*", A1, "x"], ["*", B1, "y"]])</var> = <var>C1</var>}</code><br />
<code class="hint_green"><var>expr(["+", ["*", A2, "x"], ["*", B2, "y"]])</var> = <var>C2</var></code></p>
</div>
<div class="solution" data-type="multiple">
<p><code>x</code> = <span class="sol"><var>X</var></span></p>
<p><code>y</code> = <span class="sol"><var>Y</var></span></p>
</div>
<div class="hints">
<p>We can eliminate <code>y</code> by adding the equations together when the <code>y</code> coefficients have opposite signs.</p>
<div data-if="INDEX !== 0">
<p>Multiply the <span data-if="INDEX === 2">bottom</span><span data-else>top</span> equation by <span data-if="INDEX === 2"><code><var>MULT2</var></code></span><span data-else><code><var>MULT1</var></code></span><span data-if="INDEX === 3"> and the bottom equation by <code><var>MULT2</var></code></span>.</p>
<p><code>\color{<var>BLUE</var>}{<var>expr(["+", ["*", A1 * MULT1, "x"], ["*", B1 * MULT1, "y"]])</var> = <var>C1 * MULT1</var>}</code><br />
<code class="hint_green"><var>expr(["+", ["*", A2 * MULT2, "x"], ["*", B2 * MULT2, "y"]])</var> = <var>C2 * MULT2</var></code></p>
</div>
<div>
<p>Add the top and bottom equations together.
<p data-if="( A1 * MULT1 + A2 * MULT2 ) !== 1"><code><var>expr(["*", A1 * MULT1 + A2 * MULT2, "x"])</var> = <var>C1 * MULT1 + C2 * MULT2</var></code></p>
<p data-if="( A1 * MULT1 + A2 * MULT2 ) !== 1"><code>\dfrac{<var>expr(["*", A1 * MULT1 + A2 * MULT2, "x"])</var>}{\color{<var>BLUE</var>}{<var>A1 * MULT1 + A2 * MULT2</var>}} = \dfrac{<var>C1 * MULT1 + C2 * MULT2</var>}{\color{<var>BLUE</var>}{<var>A1 * MULT1 + A2 * MULT2</var>}}</code></p>
<p><code>\color{red}{x = <var>X</var>}</code></p>
</div>
<div>
<p>Now that you know <code>\color{red}{x = <var>X</var>}</code>, plug it back into <code>\thinspace \color{<var>BLUE</var>}{<var>expr(["+", ["*", A1, "x"], ["*", B1, "y"]])</var> = <var>C1</var>}\thinspace</code> to find <code>y</code>.</p>
</div>
<div>
<p><code>\color{<var>BLUE</var>}{<span data-if="abs( A1 ) !== 1"><var>A1</var></span><span data-if="A1 === -1">-</span>}\color{red}{(<var>X</var>)}\color{<var>BLUE</var>}{ + <var>expr(["*", B1, "y"])</var> = <var>C1</var>}</code></p>
</div>
<div>
<p data-if="A1 !== 1"><code><var>expr(["+", A1 * X, ["*", B1, "y"]])</var> = <var>C1</var></code></p>
<p><code><var>A1 * X</var>\color{<var>BLUE</var>}{<var>SIGN_1</var><var>abs( A1 * X )</var>} + <var>expr(["*", B1, "y"])</var> = <var>C1</var>\color{<var>BLUE</var>}{<var>SIGN_1</var><var>abs( A1 * X )</var>}</code></p>
<p data-if="B1 !== 1"><code><var>expr(["*", B1, "y"])</var> = <var>C1 - A1 * X</var></code></p>
<p data-if="B1 !== 1"><code>\dfrac{<var>expr(["*", B1, "y"])</var>}{\color{<var>BLUE</var>}{<var>B1</var>}} = \dfrac{<var>C1 - A1 * X</var>}{\color{<var>BLUE</var>}{<var>B1</var>}}</code></p>
<p><code>\color{<var>ORANGE</var>}{y = <var>Y</var>}</code></p>
</div>
<div>
<p>You can also plug <code>\color{red}{x = <var>X</var>}</code> into <code>\thinspace \color{<var>GREEN</var>}{<var>expr(["+", ["*", A2, "x"], ["*", B2, "y"]])</var> = <var>C2</var>}\thinspace</code> and get the same answer for <code>y</code>:</p>
<p><code>\color{<var>GREEN</var>}{<span data-if="abs( A2 ) !== 1"><var>A2</var></span><span data-if="A2 === -1">-</span>}\color{red}{(<var>X</var>)}\color{<var>GREEN</var>}{ + <var>expr(["*", B2, "y"])</var> = <var>C2</var>}</code></p>
<p><code>\color{<var>ORANGE</var>}{y = <var>Y</var>}</code></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.