Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

269 lines (261 sloc) 14.224 kB
<!DOCTYPE html>
<html data-require="math math-format">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Absolute value equations</title>
<script src="../khan-exercise.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="A">randRange(2, 8)</var>
<var id="B">randRangeNonZero(-10, 10)</var>
<var id="C" data-ensure="C !== A">randRangeNonZero(-6, 6)</var>
<var id="D" data-ensure="D !== B">randRange(2, 10)</var>
<var id="E">randRangeNonZero(-10, 10)</var>
<var id="ABS_A_MINUS_C">abs(A-C)</var>
<var id="SIMPLIFIED">fractionReduce(D-B, A-C)</var>
<var id="HAS_SOLUTION">(D-B)/(A-C) > 0</var>
<var id="SIMPLIFIED_DENOM">abs((A-C)/getGCD(D-B, A-C))</var>
<var id="POS_RESULT">
(function() {
if ((D-B)/(A-C) > 0) {
return fractionReduce(abs(D-B)-E*abs(A-C), abs(A-C));
} else {
return "No solution";
}
})()
</var>
<var id="NEG_RESULT">
(function() {
if ((D-B)/(A-C) > 0) {
return fractionReduce(-1*abs(D-B)-E*abs(A-C), abs(A-C));
} else {
return "No solution";
}
})()
</var>
<var id="SOLUTION">
(function() {
if ((D-B)/(A-C) > 0) {
return "&lt;code&gt;"
+"x = "
+fractionReduce(-1*abs(D-B)-E*abs(A-C), abs(A-C))
+"\\text{ or }"
+"x = "
+fractionReduce(abs(D-B)-E*abs(A-C), abs(A-C))
+"&lt;/code&gt;";
} else {
return "No solution";
}
})()
</var>
<var id="CHOICES">
(function() {
var choices = [];
for (var i = 0; i &lt; 4; i++) {
var choice = "&lt;code&gt;";
var nOffset = randRange(1, 10);
var dOffset = randRangeExclude(1, 10, [ C-A ]);
var tOffset = randRange(1, 10);
if (D-B+nOffset === 0 &amp;&amp; E+tOffset === 0) {
choice += "x = 0";
} else {
choice += "x = "
+fractionReduce(-1*abs(D-B+nOffset)-(E+tOffset)*abs(A-C+dOffset), abs(A-C+dOffset))
+"\\text{ or }"
+"x = "
+fractionReduce(abs(D-B+nOffset)-(E+tOffset)*abs(A-C+dOffset), abs(A-C+dOffset));
}
choice += "&lt;/code&gt;";
choices.unshift(choice);
}
if ((D-B)/(A-C) > 0) {
choices.shift();
choices.unshift(SOLUTION);
choices = shuffle(choices);
choices.push("No solution");
} else {
choices = shuffle(choices);
choices.push(SOLUTION);
}
return choices;
})()</var>
</div>
<div class="problems">
<div>
<p class="question">
Solve for <code>x</code>:
<br><br>
<code>
<var>A</var>|x + <var>E</var>| + <var>B</var> =
<var>C</var>|x + <var>E</var>| + <var>D</var>
</code>
</p>
<p class="solution"><var>SOLUTION</var></p>
<ul class="choices" data-category="true">
<li data-each="CHOICES as choice"><var>choice</var></li>
</ul>
</div>
</div>
<div class="hints">
<div data-if="A > C" data-unwrap>
<div>
<p><var>C > 0 ? "Subtract" : "Add"</var> <code><var>abs(C)</var>|x + <var>E</var>|</code> <var>C > 0 ? "from" : "to"</var> both sides:</p>
<p><code>
(<var>A</var>|x + <var>E</var>| + <var>B</var>) - <var>C</var>|x + <var>E</var>| =
(<var>C</var>|x + <var>E</var>| + <var>D</var>) - <var>C</var>|x + <var>E</var>|
</code></p>
<p><code>
<var>A - C</var>|x + <var>E</var>| + <var>B</var> = <var>D</var>
</code></p>
</div>
<div>
<p><var>B > 0 ? "Subtract" : "Add"</var> <code><var>abs(B)</var></code> <var>B > 0 ? "from" : "to"</var> both sides:</p>
<p><code>
(<var>A - C</var>|x + <var>E</var>| + <var>B</var>) - <var>B</var> =
<var>D</var> - <var>B</var>
</code></p>
<p><code>
<var>A - C</var>|x + <var>E</var>| = <var>D - B</var>
</code></p>
</div>
<div data-if="ABS_A_MINUS_C !== 1">
<p>Divide both sides by <code><var>A - C</var></code>.</p>
<p><code>
\dfrac{<var>A - C</var>|x + <var>E</var>|}{<var>A - C</var>} =
<var>fraction(D-B, A-C)</var>
</code></p>
</div>
<div>
<p>Simplify.</p>
<p><code>|x + <var>E</var>| = <var>SIMPLIFIED</var></code></p>
</div>
<div data-if="HAS_SOLUTION" data-unwrap>
<div>
<p>Because the absolute value of an expression is its distance from zero, it has two solutions, one negative and one positive:</p>
<p><code>x + <var>E</var> = - <var>SIMPLIFIED</var></code></p>
<p>or</p>
<p><code>x + <var>E</var> = <var>SIMPLIFIED</var></code></p>
</div>
<div>
<p>Calculate the solution where <code>x + <var>E</var></code> is negative.</p>
<p><code>x + <var>E</var> = - <var>SIMPLIFIED</var></code></p>
</div>
<div>
<p><var>E > 0 ? "Subtract" : "Add"</var> <code><var>abs(E)</var></code> <var>E > 0 ? "from" : "to"</var> both sides:</p>
<p><code>x + <var>E</var> - <var>E</var> = - <var>SIMPLIFIED</var> - <var>E</var></code></p>
<p><code>x = - <var>SIMPLIFIED</var> - <var>E</var></code></p>
</div>
<div data-if="SIMPLIFIED_DENOM !== 1">
<p>Change the term to an equivalent fraction with a denominator of <code><var>SIMPLIFIED_DENOM</var></code>.</p>
<p><code>x = - <var>SIMPLIFIED</var> - <var>E</var>\cdot <var>fraction(SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var></code></p>
<p><code>x = - <var>SIMPLIFIED</var><var>E > 0 ? "-" : "+"</var> <var>fraction(abs(E)*SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var></code></p>
</div>
<div>
<p><code>x = <var>NEG_RESULT</var></code></p>
</div>
<div>
<p>Then calculate the solution where <code>x + <var>E</var></code> is positive.</p>
<p><code>x + <var>E</var> = <var>SIMPLIFIED</var></code></p>
</div>
<div>
<p><var>E > 0 ? "Subtract" : "Add"</var> <code><var>abs(E)</var></code> <var>E > 0 ? "from" : "to"</var> both sides:</p>
<p><code>x + <var>E</var> - <var>E</var> = <var>SIMPLIFIED</var> - <var>E</var></code></p>
<p><code>x = <var>SIMPLIFIED</var> - <var>E</var></code></p>
</div>
<div data-if="SIMPLIFIED_DENOM !== 1">
<p>Change the term to an equivalent fraction with a denominator of <code><var>SIMPLIFIED_DENOM</var></code>.</p>
<p><code>x = <var>SIMPLIFIED</var> - <var>E</var>\cdot <var>fraction(SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var></code></p>
<p><code>x = <var>SIMPLIFIED</var><var>E > 0 ? "-" : "+"</var> <var>fraction(abs(E)*SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var></code></p>
</div>
<div>
<p><code>x = <var>POS_RESULT</var></code></p>
</div>
</div>
</div>
<div data-else data-unwrap>
<div>
<p><var>A > 0 ? "Subtract" : "Add"</var> <code><var>A</var>|x + <var>E</var>|</code> <var>A > 0 ? "from" : "to"</var> both sides:</p>
<p><code>
(<var>A</var>|x + <var>E</var>| + <var>B</var>) - <var>A</var>|x + <var>E</var>| =
(<var>C</var>|x + <var>E</var>| + <var>D</var>) - <var>A</var>|x + <var>E</var>|
</code></p>
<p><code>
<var>B</var> = <var>C - A</var>|x + <var>E</var>| + <var>D</var>
</code></p>
</div>
<div>
<p><var>D > 0 ? "Subtract" : "Add"</var> <code><var>abs(D)</var></code> <var>D > 0 ? "from" : "to"</var> both sides:</p>
<p><code>
<var>B</var> - <var>D</var> =
(<var>C - A</var>|x + <var>E</var>| + <var>D</var>) - <var>D</var>
</code></p>
<p><code>
<var>B - D</var> = <var>C - A</var>|x + <var>E</var>|
</code></p>
</div>
<div data-if="ABS_A_MINUS_C !== 1">
<p>Divide both sides by <code><var>C - A</var></code>.</p>
<p><code>
<var>fraction(B-D, C-A)</var> =
\dfrac{<var>C - A</var>|x + <var>E</var>|}{<var>C - A</var>}
</code></p>
</div>
<div>
<p>Simplify.</p>
<p><code><var>SIMPLIFIED</var> = |x + <var>E</var>|</code></p>
</div>
<div data-if="HAS_SOLUTION" data-unwrap>
<div>
<p>Because the absolute value of an expression is its distance from zero, it has two solutions, one negative and one positive:</p>
<p><code>- <var>SIMPLIFIED</var> = x + <var>E</var></code></p>
<p>or</p>
<p><code><var>SIMPLIFIED</var> = x + <var>E</var></code></p>
</div>
<div>
<p>Calculate the solution where <code>x + <var>E</var></code> is negative.</p>
<p><code> - <var>SIMPLIFIED</var> = x + <var>E</var></code></p>
</div>
<div>
<p><var>E > 0 ? "Subtract" : "Add"</var> <code><var>abs(E)</var></code> <var>E > 0 ? "from" : "to"</var> both sides:</p>
<p><code> - <var>SIMPLIFIED</var> - <var>E</var> = x + <var>E</var> - <var>E</var></code></p>
<p><code> - <var>SIMPLIFIED</var> - <var>E</var> = x</code></p>
</div>
<div data-if="SIMPLIFIED_DENOM !== 1">
<p>Change the term to an equivalent fraction with a denominator of <code><var>SIMPLIFIED_DENOM</var></code>.</p>
<p><code>- <var>SIMPLIFIED</var> - <var>E</var>\cdot<var>fraction(SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var> = x</code></p>
<p><code>- <var>SIMPLIFIED</var><var>E > 0 ? "-" : "+"</var> <var>fraction(abs(E)*SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var> = x</code></p>
</div>
<div>
<p><code><var>NEG_RESULT</var> = x</code></p>
</div>
<div>
<p>Then calculate the solution where <code>x + <var>E</var></code> is positive.</p>
<p><code><var>SIMPLIFIED</var> = x + <var>E</var></code></p>
</div>
<div>
<p><var>E > 0 ? "Subtract" : "Add"</var> <code><var>abs(E)</var></code> <var>E > 0 ? "from" : "to"</var> both sides:</p>
<p><code><var>SIMPLIFIED</var> - <var>E</var> = x + <var>E</var> - <var>E</var></code></p>
<p><code><var>SIMPLIFIED</var> - <var>E</var> = x</code></p>
</div>
<div data-if="SIMPLIFIED_DENOM !== 1">
<p>Change the term to an equivalent fraction with a denominator of <code><var>SIMPLIFIED_DENOM</var></code>.</p>
<p><code><var>SIMPLIFIED</var> - <var>E</var>\cdot <var>fraction(SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var> = x</code></p>
<p><code><var>SIMPLIFIED</var><var>E > 0 ? "-" : "+"</var> <var>fraction(abs(E)*SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var> = x</code></p>
</div>
<div>
<p><code><var>POS_RESULT</var> = x</code></p>
</div>
</div>
</div>
<p class="final_answer" data-if="HAS_SOLUTION">
Thus, the correct answer is <var>SOLUTION</var>.
</p>
<p class="final_answer" data-else>
The absolute value cannot be negative. Therefore, there is no solution.
</p>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.