Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

464 lines (460 sloc) 23.508 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>
<style>
#answer_area .short input[type=text] {
width: 40px;
}
</style>
</head>
<body>
<div class="exercise">
<div class="problems">
<div id="0">
<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="NO_SOLUTION">(D - B) / (A - C) &lt;= 0</var>
<var id="POS_SOLUTION">
[abs(D - B) - E * abs(A - C), abs(A - C)]
</var>
<var id="NEG_SOLUTION">
[-1 * abs(D - B) - E * abs(A - C), abs(A - C)]
</var>
<var id="SOLUTIONS">NO_SOLUTION ? [] : [
POS_SOLUTION[0] / POS_SOLUTION[1],
NEG_SOLUTION[0] / NEG_SOLUTION[1]
]</var>
<var id="SIMPLIFIED">fractionReduce(D - B, A - C)</var>
<var id="SIMPLIFIED_DENOM">
abs((A - C) / getGCD(D - B, A - C))
</var>
</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>
<div class="solution" data-type="multiple">
<div class="sol" data-type="set">
<div class="set-sol" data-each="SOLUTIONS as SOLUTION">
<var>SOLUTION</var>
</div>
<p class="input-format">
<code>x = </code> <span class="entry short"></span>
&nbsp; or
<code>x = </code> <span class="entry short"></span>
</p>
</div>
<p></p>
<div>
<label>
<span class="sol" data-type="checkbox">
<var>NO_SOLUTION</var>
</span>
No solution
</label>
</div>
<!--
Hack to not grade an unanswered question.
Note that this custom answer is required. It checks to
see if both textboxes are empty and the checkbox isn't
checked. In that case, the custom validator returns "".
Since it's required, this will cause the entire answer
to not be graded. Otherwise it returns true an the
rest of the multiple answer will be checked normally.
-->
<div class="sol" data-type="custom" required>
<div class="guess">
$("#solutionarea input").eq(0).val() === ""
&amp;&amp;
$("#solutionarea input").eq(1).val() === ""
&amp;&amp;
!$("#solutionarea input").eq(2).is(":checked")
</div>
<div class="validator-function">
return guess ? "" : true;
</div>
</div>
<span class="example">
one or two integers, like <code>6</code>
</span>
<span class="example">
one or two <em>simplified proper</em> fractions, like
<code>3/5</code>
</span>
<span class="example">
one or two <em>simplified improper</em> fractions, like
<code>7/4</code>
</span>
<span class="example">
one or two <em>exact</em> decimals, like
<code>0.75</code>
</span>
<span class="example">
if there is no solution for <code>x</code>, leave the
boxes blank and check "<b>No solution</b>"
</span>
</div>
<div class="hints">
<div data-if="A > C" data-unwrap>
<div>
<p>
<var>C &gt; 0 ? "Subtract" : "Add"</var>
<code>
\red{<var>abs(C)</var>|x + <var>E</var>|}
</code>
<var>C &gt; 0 ? "from" : "to"</var> both sides:
</p>
<p><code>\qquad\begin{eqnarray}
<var>A</var>|x + <var>E</var>| + <var>B</var>
&amp;=&amp;
<var>C</var>|x + <var>E</var>| + <var>D</var>
\\ \\
\red{ - <var>C</var>|x + <var>E</var>|}
&amp;&amp;
\red{ - <var>C</var>|x + <var>E</var>|} \\ \\
<var>A - C</var>|x + <var>E</var>| +
<var>B</var>
&amp;=&amp; <var>D</var>
\end{eqnarray}
</code></p>
</div>
<div>
<p>
<var>B &gt; 0 ? "Subtract" : "Add"</var>
<code>\red{<var>abs(B)</var>}</code>
<var>B &gt; 0 ? "from" : "to"</var> both sides:
</p>
<p><code>\qquad\begin{eqnarray}
<var>A - C</var>|x + <var>E</var>| +
<var>B</var> &amp;=&amp; <var>D</var> \\ \\
\red{ - <var>B</var>} &amp;=&amp;
\red{ - <var>B</var>} \\ \\
<var>A - C</var>|x + <var>E</var>| &amp;=&amp;
<var>D - B</var>
\end{eqnarray}
</code></p>
</div>
<div data-if="abs(A - C) !== 1">
<p>
Divide both sides by
<code>\red{<var>A - C</var>}</code>:
</p>
<p><code>\qquad
\dfrac{<var>A - C</var>|x + <var>E</var>|}
{\red{<var>A - C</var>}} =
\dfrac{<var>D - B</var>}
{\red{<var>A - C</var>}}
</code></p>
</div>
<div>
<p>Simplify:</p>
<p>
<code>\qquad |x + <var>E</var>| =
<var>SIMPLIFIED</var></code>
</p>
</div>
<div data-if="!NO_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>\qquad
x + <var>E</var> = -<var>SIMPLIFIED</var>
</code></p>
<p>or</p>
<p><code>\qquad
x + <var>E</var> = <var>SIMPLIFIED</var>
</code></p>
</div>
<div>
<p>
Solve for the solution where
<code>x + <var>E</var></code> is negative:
</p>
<p><code>\qquad
x + <var>E</var> = -<var>SIMPLIFIED</var>
</code></p>
</div>
<div>
<p>
<var>E &gt; 0 ? "Subtract" : "Add"</var>
<code>\red{<var>abs(E)</var>}</code>
<var>E &gt; 0 ? "from" : "to"</var> both
sides:
</p>
<p><code>\qquad\begin{eqnarray}
x + <var>E</var> &amp;=&amp;
-<var>SIMPLIFIED</var> \\ \\
\red{- <var>E</var>} &amp;&amp;
\red{- <var>E</var>} \\ \\
x &amp;=&amp; -<var>SIMPLIFIED</var> -
<var>E</var>
\end{eqnarray}
</code></p>
</div>
<div data-if="SIMPLIFIED_DENOM !== 1">
<p>
Change the
<code>\red{{} - <var>E</var>}</code>
to an equivalent fraction with a
denominator of
<code><var>SIMPLIFIED_DENOM</var></code>:
</p>
<p><code>\qquad
x = - <var>SIMPLIFIED</var>
\red{<var>E &gt; 0 ? "-" : "+"</var>
<var>fraction(abs(E) * SIMPLIFIED_DENOM,
SIMPLIFIED_DENOM)</var>}
</code></p>
</div>
<p><code>\qquad
x = <var>fractionReduce.apply(null,
NEG_SOLUTION)</var>
</code></p>
<div>
<p>
Then calculate the solution where
<code>x + <var>E</var></code> is positive:
</p>
<p><code>\qquad
x + <var>E</var> = <var>SIMPLIFIED</var>
</code></p>
</div>
<div>
<p>
<var>E &gt; 0 ? "Subtract" : "Add"</var>
<code>\red{<var>abs(E)</var>}</code>
<var>E &gt; 0 ? "from" : "to"</var> both
sides:
</p>
<p><code>\qquad\begin{eqnarray}
x + <var>E</var> &amp;=&amp;
<var>SIMPLIFIED</var> \\ \\
\red{- <var>E</var>} &amp;&amp;
\red{- <var>E</var>} \\ \\
x &amp;=&amp; <var>SIMPLIFIED</var> -
<var>E</var>
\end{eqnarray}
</code></p>
</div>
<div data-if="SIMPLIFIED_DENOM !== 1">
<p>
Change the
<code>\red{{} - <var>E</var>}</code>
to an equivalent fraction with a
denominator of
<code><var>SIMPLIFIED_DENOM</var></code>:
</p>
<p><code>\qquad
x = <var>SIMPLIFIED</var>
\red{<var>E &gt; 0 ? "-" : "+"</var>
<var>fraction(abs(E) * SIMPLIFIED_DENOM,
SIMPLIFIED_DENOM)</var>}
</code></p>
</div>
<p><code>\qquad
x = <var>fractionReduce.apply(null,
POS_SOLUTION)</var>
</code></p>
</div>
</div>
<div data-else data-unwrap>
<div>
<p>
<var>A &gt; 0 ? "Subtract" : "Add"</var>
<code>
\red{<var>A</var>|x + <var>E</var>|}
</code>
<var>A &gt; 0 ? "from" : "to"</var> both sides:
</p>
<p><code>\qquad\begin{eqnarray}
<var>A</var>|x + <var>E</var>| + <var>B</var>
&amp;=&amp;
<var>C</var>|x + <var>E</var>| + <var>D</var>
\\ \\ \red{- <var>A</var>|x + <var>E</var>|}
&amp;&amp;
\red{- <var>A</var>|x + <var>E</var>|} \\ \\
<var>B</var> &amp;=&amp;
<var>C - A</var>|x + <var>E</var>| +
<var>D</var>
\end{eqnarray}
</code></p>
</div>
<div>
<p>
<var>D &gt; 0 ? "Subtract" : "Add"</var>
<code><var>abs(D)</var></code>
<var>D &gt; 0 ? "from" : "to"</var> both sides:
</p>
<p><code>\qquad\begin{eqnarray}
<var>B</var> &amp;=&amp;
<var>C - A</var>|x + <var>E</var>| +
<var>D</var> \\ \\
\red{- <var>D</var>} &amp;&amp;
\red{- <var>D</var>} \\ \\
<var>B - D</var> &amp;=&amp;
<var>C - A</var>|x + <var>E</var>|
\end{eqnarray}
</code></p>
</div>
<div data-if="abs(A - C) !== 1">
<p>
Divide both sides by
<code>\red{<var>C - A</var>}</code>.
</p>
<p><code>\qquad
\dfrac{<var>B - D</var>}
{\red{<var>C - A</var>}} =
\dfrac{<var>C - A</var>|x + <var>E</var>|}
{\red{<var>C - A</var>}}
</code></p>
</div>
<div>
<p>Simplify:</p>
<p><code>\qquad
<var>SIMPLIFIED</var> = |x + <var>E</var>|
</code></p>
</div>
<div data-if="!NO_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>\qquad
-<var>SIMPLIFIED</var> = x + <var>E</var>
</code></p>
<p>or</p>
<p><code>\qquad
<var>SIMPLIFIED</var> = x + <var>E</var>
</code></p>
</div>
<div>
<p>
Solve for the solution where
<code>x + <var>E</var></code> is negative:
</p>
<p>
<code>\qquad - <var>SIMPLIFIED</var> = x +
<var>E</var></code>
</p>
</div>
<div>
<p>
<var>E &gt; 0 ? "Subtract" : "Add"</var>
<code>\red{<var>abs(E)</var>}</code>
<var>E &gt; 0 ? "from" : "to"</var> both
sides:
</p>
<p><code>\qquad\begin{eqnarray}
- <var>SIMPLIFIED</var> &amp;=&amp;
x + <var>E</var> \\ \\
\red{- <var>E</var>} &amp;&amp;
\red{- <var>E</var>} \\ \\
-<var>SIMPLIFIED</var> - <var>E</var>
&amp;=&amp; x
\end{eqnarray}
</code></p>
</div>
<div data-if="SIMPLIFIED_DENOM !== 1">
<p>
Change the
<code>\red{{} - <var>E</var>}</code>
to an equivalent fraction with a
denominator of
<code><var>SIMPLIFIED_DENOM</var></code>.
</p>
<p><code>\qquad
- <var>SIMPLIFIED</var>
\red{<var>E &gt; 0 ? "-" : "+"</var>
<var>fraction(abs(E) * SIMPLIFIED_DENOM,
SIMPLIFIED_DENOM)</var>} = x
</code></p>
</div>
<p><code>\qquad
<var>fractionReduce.apply(null,
NEG_SOLUTION)</var> = x
</code></p>
<div>
<p>
Then calculate the solution where
<code>x + <var>E</var></code> is positive:
</p>
<p><code>\qquad
<var>SIMPLIFIED</var> = x + <var>E</var>
</code></p>
</div>
<div>
<p>
<var>E &gt; 0 ? "Subtract" : "Add"</var>
<code>\red{<var>abs(E)</var>}</code>
<var>E &gt; 0 ? "from" : "to"</var> both
sides:
</p>
<p><code>\qquad\begin{eqnarray}
<var>SIMPLIFIED</var> &amp;=&amp;
x + <var>E</var> \\ \\
\red{- <var>E</var>} &amp;&amp;
\red{- <var>E</var>} \\ \\
<var>SIMPLIFIED</var> - <var>E</var>
&amp;=&amp; x
\end{eqnarray}
</code></p>
</div>
<div data-if="SIMPLIFIED_DENOM !== 1">
<p>
Change the
<code>\red{{} - <var>E</var>}</code>
to an equivalent fraction with a
denominator of
<code><var>SIMPLIFIED_DENOM</var></code>.
</p>
<p><code>\qquad
<var>SIMPLIFIED</var>
\red{<var>E &gt; 0 ? "-" : "+"</var>
<var>fraction(abs(E) * SIMPLIFIED_DENOM,
SIMPLIFIED_DENOM)</var>} = x
</code></p>
</div>
<p><code>\qquad
<var>fractionReduce.apply(null,
POS_SOLUTION)</var> = x
</code></p>
</div>
</div>
<p data-if="!NO_SOLUTION">
Thus, the correct answer is
<code>x =
<var>fractionReduce.apply(null, NEG_SOLUTION)</var>
</code>
or
<code>x =
<var>fractionReduce.apply(null, POS_SOLUTION)</var>
</code>.
</p>
<p data-else>
The absolute value cannot be negative. Therefore, there
is no solution.
</p>
</div>
</div>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.