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

289 lines (274 sloc) 19.692 kb
<!DOCTYPE html>
<html data-require="math math-format expressions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Systems of equations</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars" data-ensure="abs(X_DENOM) &lt; 6 &amp;&amp; abs(Y_DENOM) &lt; 6 &amp;&amp; abs(X_NUMER) &lt; 11 &amp;&amp; abs(Y_NUMER) &lt; 11">
<var id="A1">randRangeNonZero(-6, 6)</var>
<var id="A2">randRangeNonZero(-6, 6)</var>
<var id="B1">randRangeNonZero(-6, 6)</var>
<var id="B2" data-ensure="(B1 * A2) !== (A1 * B2)">randRangeNonZero(-6, 6)</var>
<var id="C1">randRangeNonZero(-9, 9)</var>
<var id="C2">randRangeNonZero(-9, 9)</var>
<var id="MULT_1, MULT_2">(function() {
var lcm = getLCM(abs(A1), abs(A2));
var m1 = lcm / abs(A1);
var m2 = lcm / abs(A2);
if (A1 * A2 &gt; 0) {
if (m1 === 1) {
m2 *= -1;
} else {
m1 *= -1;
}
}
return [m1, m2];
})()</var>
<var id="MULT_3, MULT_4">(function() {
var lcm = getLCM(abs(B1), abs(B2));
var m1 = lcm / abs(B1);
var m2 = lcm / abs(B2);
if (B1 * B2 &gt; 0) {
if (m1 === 1) {
m2 *= -1;
} else {
m1 *= -1;
}
}
return [m1, m2];
})()</var>
<var id="XY_FLAG">abs(MULT_1 * MULT_2) &lt; abs(MULT_3 * MULT_4) ? true : false</var>
<var id="MULT_A, MULT_B">XY_FLAG ? [MULT_1, MULT_2] : [MULT_3, MULT_4]</var>
<var id="X_NUMER1">C1 * (B1 * MULT_1 + B2 * MULT_2) - B1 * (C1 * MULT_1 + C2 * MULT_2)</var>
<var id="X_DENOM1">A1 * (B1 * MULT_1 + B2 * MULT_2)</var>
<var id="X_GCD">getGCD(X_NUMER1, X_DENOM1)</var>
<var id="X_NUMER">X_NUMER1 / X_GCD</var>
<var id="X_DENOM">X_DENOM1 / X_GCD</var>
<var id="X_NUMER2">C1 * MULT_3 + C2 * MULT_4</var>
<var id="X_DENOM2">A1 * MULT_3 + A2 * MULT_4</var>
<var id="Y_NUMER1">C1 * MULT_1 + C2 * MULT_2</var>
<var id="Y_DENOM1">B1 * MULT_1 + B2 * MULT_2</var>
<var id="Y_GCD">getGCD(Y_NUMER1, Y_DENOM1)</var>
<var id="Y_NUMER">Y_NUMER1 / Y_GCD</var>
<var id="Y_DENOM">Y_DENOM1 / Y_GCD</var>
</div>
<div class="problems">
<div id="elimination">
<p class="problem">Solve for <code>x</code> and <code>y</code>.</p>
<p class="question">
<code>\begin{align*}
<var>expr(["+", ["*", A1, "x"], ["*", B1, "y"]])</var> &amp;= <var>C1</var> \\
<var>expr(["+", ["*", A2, "x"], ["*", B2, "y"]])</var> &amp;= <var>C2</var>
\end{align*}</code>
</p>
<div class="solution" data-type="multiple">
<p><code>x</code> = <span class="sol"><var>X_NUMER2 / X_DENOM2</var></span></p>
<p><code>y</code> = <span class="sol"><var>Y_NUMER / Y_DENOM</var></span></p>
</div>
<div class="hints">
<div>
<p>One way to solve this system of equations is to use elimination.</p>
<p data-if="XY_FLAG">
In order to eliminate <code>\blue{x}</code>, we need to make its coefficient in one equation equal to
the negative of its coefficient for the other equation.
</p>
<p data-else="">
In order to eliminate <code>\green{y}</code>, we need to make its coefficient in one equation equal to
the negative of its coefficient for the other equation.
</p>
<p>
<code>\begin{align*}
\blue{<var>expr(["*", A1, "x"])</var>} <span data-if="B1 &gt; 0">+</span>
\green{<var>expr(["*", B1, "y"])</var>} &amp;= <var>C1</var> \\
\blue{<var>expr(["*", A2, "x"])</var>} <span data-if="B2 &gt; 0">+</span>
\green{<var>expr(["*", B2, "y"])</var>} &amp;= <var>C2</var>
\end{align*}</code>
</p>
</div>
<div data-if="MULT_A !== 1 || MULT_B !== 1">
<p>
Multiply <span data-if="MULT_A !== 1">the top equation by <code><var>MULT_A</var></code></span><span data-if="MULT_A !== 1 &amp;&amp; MULT_B !== 1"> and </span><span data-if="MULT_B !== 1">the bottom equation by <code><var>MULT_B</var></code></span>.
</p>
<p>
<code>\begin{align*}
\blue{<var>expr(["*", A1 * MULT_A, "x"])</var>} <span data-if="B1 * MULT_A &gt; 0">+</span>
\green{<var>expr(["*", B1 * MULT_A, "y"])</var>} &amp;= <var>C1 * MULT_A</var> \\
\blue{<var>expr(["*", A2 * MULT_B, "x"])</var>} <span data-if="B2 * MULT_B &gt; 0">+</span>
\green{<var>expr(["*", B2 * MULT_B, "y"])</var>} &amp;= <var>C2 * MULT_B</var>
\end{align*}</code>
</p>
</div>
<div data-if="XY_FLAG" data-unwrap="">
<div>
<p>Add the top and bottom equations.</p>
<p><code>\green{<var>expr(["*", Y_DENOM1, "y"])</var>} = <var>Y_NUMER1</var></code></p>
</div>
<div data-if="Y_DENOM1 !== 1">
<p>
Divide both sides by <code><var>Y_DENOM1</var></code><span data-if="Y_NUMER !== 0 &amp;&amp; Y_GCD !== 1"> and simplify</span>.
</p>
<p><code>\green{y = <var>fractionReduce(Y_NUMER, Y_DENOM)</var>}</code></p>
</div>
<p>Substitute <code>\green{<var>fractionReduce(Y_NUMER, Y_DENOM)</var>}</code> for <code>\green{y}</code> in the top equation.</p>
<div>
<p><code>
\blue{<var>expr(["*", A1, "x"])</var>} <span data-if="B1 &gt; 0">+</span>
\green{<var>B1</var>}(\green{<var>fractionReduce(Y_NUMER, Y_DENOM)</var>}) = <var>C1</var>
</code></p>
<p><code data-if="Y_NUMER !== 0">
\blue{<var>expr(["*", A1, "x"])</var>} <span data-if="B1 * Y_NUMER * Y_DENOM &gt; 0">+</span>
<var>fractionReduce(B1 * Y_NUMER, Y_DENOM)</var> = <var>C1</var>
</code></p>
<p><code>
\blue{<var>expr(["*", A1, "x"])</var>} = <var>fractionReduce(C1 * Y_DENOM - B1 * Y_NUMER, Y_DENOM)</var>
</code></p>
<p><code data-if="A1 !== 1">\blue{x = <var>fractionReduce(X_NUMER, X_DENOM)</var>}</code></p>
<p>
The solution is <code>\blue{x = <var>fractionReduce(X_NUMER, X_DENOM)</var>}, \enspace
\green{y = <var>fractionReduce(Y_NUMER, Y_DENOM)</var>}</code>.
</p>
</div>
</div>
<div data-else="" data-unwrap="">
<div>
<p>Add the top and bottom equations.</p>
<p><code>\blue{<var>expr(["*", X_DENOM2, "x"])</var>} = <var>X_NUMER2</var></code></p>
</div>
<div data-if="X_DENOM1 !== 1">
<p>
Divide both sides by <code><var>X_DENOM2</var></code><span data-if="getGCD(X_NUMER2, X_DENOM2) !== 1"> and simplify</span>.
</p>
<p><code>\blue{x = <var>fractionReduce(X_NUMER2, X_DENOM2)</var>}</code></p>
</div>
<p>Substitute <code>\blue{<var>fractionReduce(X_NUMER2, X_DENOM2)</var>}</code> for <code>\blue{x}</code> in the top equation.</p>
<div>
<p><code>
\blue{<var>A1</var>}(\blue{<var>fractionReduce(X_NUMER2, X_DENOM2)</var>}) <span data-if="B1 &gt; 0">+</span>
\green{<var>expr(["*", B1, "y"])</var>} = <var>C1</var>
</code></p>
<p><code data-if="X_NUMER !== 0">
<var>fractionReduce(A1 * X_NUMER2, X_DENOM2)</var> <span data-if="B1 &gt; 0">+</span>
\green{<var>expr(["*", B1, "y"])</var>} = <var>C1</var>
</code></p>
<p><code>
\green{<var>expr(["*", B1, "y"])</var>} = <var>fractionReduce(C1 * X_DENOM2 - A1 * X_NUMER2, X_DENOM2)</var>
</code></p>
<p><code data-if="A1 !== 1">\green{y = <var>fractionReduce(Y_NUMER, Y_DENOM)</var>}</code></p>
<p>
The solution is <code>\blue{x = <var>fractionReduce(X_NUMER2, X_DENOM2)</var>}, \enspace
\green{y = <var>fractionReduce(Y_NUMER, Y_DENOM)</var>}</code>.
</p>
</div>
</div>
</div>
</div>
<div id="substitution-y">
<div class="vars">
<var id="A1_SIGN">A1 &gt; 0 ? "" : "-"</var>
<var id="B1_SIGN">B1 &gt; 0 ? "+" : "-"</var>
<var id="SIGN_1">A2 / B2 &gt; 0 ? "-" : ""</var>
<var id="SIGN_2">A2 / B2 * B1 &gt; 0 ? "-" : ""</var>
</div>
<p class="problem">Solve for <code>x</code> and <code>y</code>.</p>
<p class="question"><code>\begin{align*}<var>expr(["+", ["*", A1, "x"], ["*", B1, "y"]])</var> &amp;= <var>C1</var> \\
<var>expr(["+", ["*", A2, "x"], ["*", B2, "y"]])</var> &amp;= <var>C2</var>\end{align*}</code></p>
<div class="solution" data-type="multiple">
<p><code>x</code> = <span class="sol"><var>X_NUMER / X_DENOM</var></span></p>
<p><code>y</code> = <span class="sol"><var>Y_NUMER / Y_DENOM</var></span></p>
</div>
<div class="hints">
<div>
<p>
One way to solve this system of equations is by deriving an expression for <code>y</code> from the second equation,
and substituting it back into the first equation.
</p>
<p>Begin by subtracting <code><var>expr(["*", A2, "x"])</var></code> from both sides of the second equation.</p>
<p><code><var>expr(["*", B2, "y"])</var> = <span data-if="B2 === 1">\blue{</span><var>expr(["+", ["*", -A2, "x"], C2])</var><span data-if="B2 === 1">}</span></code></p>
</div>
<div data-if="B2 !== 1">
<p>Divide both sides by <code><var>B2</var></code> to isolate <code>y</code>.</p>
<p><code>y = \blue{<span data-if="abs( abs( A2 / B2 ) - 1 ) < 0.0001"><var>SIGN_1</var></span><span data-else=""><var>decimalFraction( -A2 / B2, "true", "true" )</var></span>x + <var>decimalFraction( C2 / B2, "true", "true" )</var>}</code></p>
</div>
<div>
<p>Substitute this expression for <code>y</code> in the first equation.</p>
<p><code><var>expr(["*", A1, "x"])</var><var>B1_SIGN</var><span data-if="abs( B1 ) !== 1"><var>abs( B1 )</var></span>(\blue{<span data-if="abs( abs( A2 / B2 ) - 1 ) < 0.0001"><var>SIGN_1</var></span><span data-else=""><var>decimalFraction( -A2 / B2, "true", "true" )</var></span>x + <var>decimalFraction( C2 / B2, "true", "true" )</var>}) = <var>C1</var></code></p>
</div>
<p><code><var>expr(["*", A1, "x"])</var> + <span data-if="abs( abs( -A2 / B2 * B1 ) - 1 ) < 0.0001"><var>SIGN_2</var></span><span data-else=""><var>decimalFraction( -A2 / B2 * B1, "true", "true" )</var></span>x + <var>decimalFraction( C2 / B2 * B1, "true", "true" )</var> = <var>C1</var></code></p>
<div>
<p>Simplify by combining terms, then solve for <code>x</code>.</p>
<p><code><var>decimalFraction( A1 + ( -A2 / B2 * B1 ), "true", "true" )</var>x + <var>decimalFraction( C2 / B2 * B1, "true", "true" )</var> = <var>C1</var></code></p>
<p><code><var>decimalFraction( A1 + ( -A2 / B2 * B1 ), "true", "true" )</var>x = <var>decimalFraction( C1 - ( C2 / B2 * B1 ), "true", "true" )</var></code></p>
<p><code>x = <var>fractionReduce( X_NUMER, X_DENOM )</var></code></p>
</div>
<div>
<p>Substitute <code><var>fractionReduce( X_NUMER, X_DENOM )</var></code> for <code>x</code> back into the top equation.</p>
<p><code><var>expr(["+", ["*", A1, " " + fractionReduce( X_NUMER, X_DENOM )], ["*", B1, "y"]])</var> = <var>C1</var></code></p>
<p><code><var>expr(["+", fractionReduce( A1 * X_NUMER, X_DENOM ), ["*", B1, "y"]])</var> = <var>C1</var></code></p>
<p><code><var>expr(["*", B1, "y"])</var> = <var>fractionReduce( C1 * X_DENOM - A1 * X_NUMER, X_DENOM )</var></code></p>
<p><code data-if="B1 !== 1">y = <var>fractionReduce(Y_NUMER, Y_DENOM)</var></code></p>
</div>
<p>
The solution is <code>x = <var>fractionReduce(X_NUMER, X_DENOM)</var>, \enspace y = <var>fractionReduce(Y_NUMER, Y_DENOM)</var></code>.
</p>
</div>
</div>
<div id="substitution-x">
<div class="vars">
<var id="A1_SIGN">A1 &gt; 0 ? "" : "-"</var>
<var id="B1_SIGN">B1 &gt; 0 ? "+" : "-"</var>
<var id="SIGN_1">A2 / B2 &gt; 0 ? "-" : ""</var>
<var id="SIGN_2">A2 / B2 * A1 &gt; 0 ? "-" : ""</var>
</div>
<p class="problem">Solve for <code>x</code> and <code>y</code>.</p>
<p class="question"><code>\begin{align*}<var>expr(["+", ["*", A1, "x"], ["*", B1, "y"]])</var> &amp;= <var>C1</var> \\
<var>expr(["+", ["*", A2, "x"], ["*", B2, "y"]])</var> &amp;= <var>C2</var>\end{align*}</code></p>
<div class="solution" data-type="multiple">
<p><code>x</code> = <span class="sol"><var>X_NUMER / X_DENOM</var></span></p>
<p><code>y</code> = <span class="sol"><var>Y_NUMER / Y_DENOM</var></span></p>
</div>
<div class="hints">
<div>
<p>
One way to solve this system of equations is by deriving an expression for <code>x</code> from the second equation,
and substituting it back into the first equation.
</p>
<p>Begin by subtracting <code><var>expr(["*", B2, "y"])</var></code> from both sides of the second equation.</p>
<p><code>
<var>expr(["*", A2, "x"])</var> = <span data-if="A2 === 1">\blue{</span>
<var>expr(["+", ["*", -B2, "y"], C2])</var><span data-if="A2 === 1">}</span>
</code></p>
</div>
<div data-if="A2 !== 1">
<p>Divide both sides by <code><var>A2</var></code> to isolate <code>x</code>.</p>
<p><code>x = \blue{<span data-if="abs( abs( B2 / A2 ) - 1 ) < 0.0001"><var>SIGN_1</var></span><span data-else=""><var>decimalFraction( -B2 / A2, "true", "true" )</var></span>y + <var>decimalFraction( C2 / A2, "true", "true" )</var>}</code></p>
</div>
<div>
<p>Substitute this expression for <code>x</code> in the first equation.</p>
<p><code><var>A1_SIGN</var><span data-if="abs( A1 ) !== 1"><var>abs( A1 )</var></span>(\blue{<span data-if="abs( abs( A2 / B2 ) - 1 ) < 0.0001"><var>SIGN_1</var></span><span data-else=""><var>decimalFraction( -B2 / A2, "true", "true" )</var></span>y + <var>decimalFraction( C2 / A2, "true", "true" )</var>}) + <var>expr(["*", B1, "y"])</var> = <var>C1</var></code></p>
</div>
<p><code><span data-if="abs( abs( -B2 / A2 * A1 ) - 1 ) < 0.0001"><var>SIGN_2</var></span><span data-else=""><var>decimalFraction( -B2 / A2 * A1, "true", "true" )</var></span>y + <var>decimalFraction( C2 / A2 * A1, "true", "true" )</var> + <var>expr(["*", B1, "y"])</var> = <var>C1</var></code></p>
<div>
<p>Simplify by combining terms, then solve for <code>y</code>.</p>
<p><code><var>decimalFraction( B1 + ( -B2 / A2 * A1 ), "true", "true" )</var>y + <var>decimalFraction( C2 / A2 * A1, "true", "true" )</var> = <var>C1</var></code></p>
<p><code><var>decimalFraction( B1 + ( -B2 / A2 * A1 ), "true", "true" )</var>y = <var>decimalFraction( C1 - ( C2 / A2 * A1 ), "true", "true" )</var></code></p>
<p><code>y = <var>fractionReduce(Y_NUMER, Y_DENOM)</var></code></p>
</div>
<div>
<p>Substitute <code><var>fractionReduce( Y_NUMER, Y_DENOM )</var></code> for <code>y</code> in the top equation.</p>
<p><code><var>expr(["+", ["*", A1, "x"], ["*", B1, " " + fractionReduce( Y_NUMER, Y_DENOM )]])</var> = <var>C1</var></code></p>
<p><code><var>expr(["+", ["*", A1, "x"], fractionReduce( B1 * Y_NUMER, Y_DENOM )])</var> = <var>C1</var></code></p>
<p><code><var>expr(["*", A1, "x"])</var> = <var>fractionReduce(C1 * Y_DENOM - B1 * Y_NUMER, Y_DENOM)</var></code></p>
<p><code data-if="A1 !== 1">x = <var>fractionReduce(X_NUMER, X_DENOM)</var></code></p>
</div>
<p>
The solution is <code>x = <var>fractionReduce(X_NUMER, X_DENOM)</var>,\enspace y = <var>fractionReduce(Y_NUMER, Y_DENOM)</var></code>.
</p>
</div>
</div>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.