Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
add exercises for solving polynomials by factoring
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdyer committed Jan 11, 2012
1 parent 32b64ee commit 68290a1
Show file tree
Hide file tree
Showing 3 changed files with 204 additions and 2 deletions.
96 changes: 96 additions & 0 deletions exercises/factoring_polynomials_to_solve_1.html
@@ -0,0 +1,96 @@
<!DOCTYPE html>
<html data-require="math graphie ast math-model">
<head>
<meta charset="UTF-8" />
<title>Factoring Polynomials to Solve for the Unknown (A=1)</title>
<script src="../khan-exercise.js"></script>
</head>
<body>
<div class="exercise">
<div class="problems">
<div>
<div class="vars">
<var id="MATH">MathModel.init()</var>
<var id="a_val">randRangeNonZero(-4, 4)</var>
<var id="b_val">randRange(6, 19)</var>
<var id="c_val">randRange(20, 29)</var>
<var id="B">a_val+b_val</var>
<var id="C">a_val*b_val</var>
<var id="PROBLEM">MATH.parse("x^2+"+B+"x+"+C+"=0")</var>
</div>
<div>
<p class="question">
Solve for x given the following equation:
</p>
<p>
<code><var>MATH.format(PROBLEM, "large")</var></code>
</p>
</div>

<div class="solution" data-type="set">
<div class="set-sol"><var>-a_val</var></div>
<div class="set-sol"><var>-b_val</var></div>
<div class="input-format">
<p><code>x = \quad</code><span class="entry short"></span><code>\quad \text{or} \quad x = \quad</code><span class="entry short"></span></p>
</div>
</div>


<div class="hints">
<p>
Recognize that the left hand side expression is of the form
<code><var>MATH.format("x^2+Bx+C", "normalsize", KhanUtil.BLUE)</var></code>
, which can be factored by grouping.
</p>
<p>
Find the factors
<code><var>MATH.format("a", "normalsize", KhanUtil.BLUE)</var></code> and
<code><var>MATH.format("b", "normalsize", KhanUtil.BLUE)</var></code> of the value of
<code><var>MATH.format("C="+C, "normalsize", KhanUtil.BLUE)</var></code> whose sum is the value of
<code><var>MATH.format("B="+B, "normalsize", KhanUtil.BLUE)</var></code>.
</p>
<p>
<code><var>MATH.format("a="+a_val, "normalsize", KhanUtil.BLUE)</var></code><br>
<code><var>MATH.format("b="+b_val, "normalsize", KhanUtil.BLUE)</var></code>
</p>
<p>
Rewrite the middle term of the original equation using these factors to form
two groups.
</p>
<p>
<code><var>MATH.format("x^2+"+a_val+"x+"+b_val+"x+"+C+"=0", "normalsize", KhanUtil.BLUE)</var></code>
</p>
<p>
Factor the first two terms terms and the second two terms.
</p>
<p>
<code><var>MATH.format("x(x+"+a_val+")+"+b_val+"(x+"+a_val+")=0", "normalsize", KhanUtil.BLUE)</var></code>
</p>
<p>
Redistribute the common term to get the answer.
</p>
<p>
<code><var>MATH.format("(x+"+b_val+")(x+"+a_val+")=0", "normalsize", KhanUtil.BLUE)</var></code>
</p>
<p>
Recall that for the left hand side to be equal to zero one or both of the terms being multiplied must be equal to zero.
</p>
<p>
<code><var>MATH.format("(x+"+b_val+")=0", "normalsize", KhanUtil.BLUE)</var></code>
<b>or</b>
<code><var>MATH.format("(x+"+a_val+")=0", "normalsize", KhanUtil.BLUE)</var></code>
</p>
<p>
Therefore the solutions are:
</p>
<p>
<code><var>MATH.format("x="+(-b_val), "large", KhanUtil.GREEN)</var></code>
<b>or</b>
<code><var>MATH.format("x="+(-a_val), "large", KhanUtil.GREEN)</var></code>
</p>
</div>
</div>
</div>
</div>
</body>
</html>
106 changes: 106 additions & 0 deletions exercises/factoring_polynomials_to_solve_2.html
@@ -0,0 +1,106 @@
<!DOCTYPE html>
<html data-require="math graphie ast math-model">
<head>
<meta charset="UTF-8" />
<title>Factoring Polynomials to Solve for the Unknown (A!=1)</title>
<script src="../khan-exercise.js"></script>
</head>
<body>
<div class="exercise">
<div class="problems">
<div>
<div class="vars">
<var id="MATH">MathModel.init()</var>
<var id="a">randRange(2, 9)</var>
<var id="b_sign">randFromArray([-1, 1])</var>
<var id="b_abs">randFromArrayExclude([3, 5, 7, 9], [a])</var>
<var id="b">b_sign*b_abs</var>
<var id="A">randFromArrayExclude(getFactors(a*b_abs), [1])</var>
<var id="B">a+b</var>
<var id="C">a*b/A</var>
<var id="F1">getGCD(A, a)</var>
<var id="F2">b_sign*getGCD(b_abs, C)</var>
<var id="PROBLEM">MATH.parse(A+"x^2+"+B+"x+"+C+"=0")</var>
<var id="SOLUTION">MATH.parse("("+F1+"x+"+F2+")("+A/F1+"x+"+a/F1+")=0")</var>
<var id="HINT1">MATH.parse(F1+"x("+A/F1+"x+"+a/F1+")+"+F2+"("+b/F2+"x+"+C/F2+")=0")</var>
<var id="X">MATH.parse("x=1/2")</var>
<var id="A1">(-F2)/F1</var>
<var id="A2">(-a/F1)/(A/F1)</var>
</div>
<div>
<p class="question">
Solve for x given the following equation:
</p>
<p>
<code><var>MATH.format(PROBLEM, "large")</var></code>
</p>
</div>

<div class="solution" data-type="set">
<div class="set-sol" data-type="rational" data-simplify="optional"><var>A1</var></div>
<div class="set-sol" data-type="rational" data-simplify="optional"><var>A2</var></div>
<div class="input-format">
<p><code>x = \quad</code><span class="entry short"></span>
<code>\quad \text{or} \quad x = \quad</code><span class="entry short"></span>
</p>
</div>
</div>

<div class="hints">
<p>
Recognize that the left hand side expression is of the form
<code><var>MATH.format("Ax^2+Bx+C", "normalsize", KhanUtil.BLUE)</var></code>
, which can be factored by grouping.
</p>
<p>
Find the factors
<code><var>MATH.format("a", "normalsize", KhanUtil.BLUE)</var></code> and
<code><var>MATH.format("b", "normalsize", KhanUtil.BLUE)</var></code> of the value of
<code><var>MATH.format("A*C="+(A*C), "normalsize", KhanUtil.BLUE)</var></code> whose sum is the value of
<code><var>MATH.format("B="+B, "normalsize", KhanUtil.BLUE)</var></code>.
</p>
<p>
<code><var>MATH.format("a="+a, "normalsize", KhanUtil.BLUE)</var></code><br>
<code><var>MATH.format("b="+b, "normalsize", KhanUtil.BLUE)</var></code>
</p>
<p>
Rewrite the middle term of the original equation using these factors to form
two groups.
</p>
<p>
<code><var>MATH.format(A+"x^2+"+a+"x+"+b+"x+"+C+"=0", "normalsize", KhanUtil.BLUE)</var></code>
</p>
<p>
Factor the first two terms terms and the second two terms.
</p>
<p>
<code><var>MATH.format(HINT1, "normalsize", KhanUtil.BLUE)</var></code>
</p>
<p>
Redistribute the common term to get the answer.
</p>
<p>
<code><var>MATH.format("("+F1+"x+"+F2+")("+A/F1+"x+"+a/F1+")=0", "normalsize", KhanUtil.BLUE)</var></code>
</p>
<p>
Recall that for the left hand side to be equal to zero one or both of the terms being multiplied must be equal to zero.
Therefore, if x satisfies either of the following equations it satisfies the original equation.
</p>
<p>
<code><var>MATH.format(F1+"x+"+F2+"=0", "normalsize", KhanUtil.BLUE)</var></code> <br>
<code><var>MATH.format(A/F1 + "x+" + a/F1 + "=0", "normalsize", KhanUtil.BLUE)</var></code>
</p>
<p>
Solve for x in both equations.
</p>
<p>
<code><var>MATH.format("x="+"-"+F2+"/"+F1, "normalsize", KhanUtil.GREEN)</var>\quad</code>
<b>or</b>
<code>\quad<var>MATH.format("x="+"-"+a/F1+"/"+A/F1, "normalsize", KhanUtil.GREEN)</var></code>
</p>
</div>
</div>
</div>
</div>
</body>
</html>
4 changes: 2 additions & 2 deletions utils/math-model.js
Expand Up @@ -102,7 +102,7 @@ jQuery.extend ( KhanUtil, {
tokenToOperator[TK_PM] = OpStr.PM;
tokenToOperator[TK_CARET] = OpStr.POW;
tokenToOperator[TK_MUL] = OpStr.MUL;
tokenToOperator[TK_DIV] = OpStr.DIV;
tokenToOperator[TK_DIV] = OpStr.FRAC;
tokenToOperator[TK_SIN] = OpStr.SIN;
tokenToOperator[TK_COS] = OpStr.COS;
tokenToOperator[TK_TAN] = OpStr.TAN;
Expand Down Expand Up @@ -303,7 +303,7 @@ jQuery.extend ( KhanUtil, {
if (expr2===1) {
expr = expr;
}
else if (expr === 1) {
else if (t===TK_MUL && expr===1) {
expr = expr2;
}
else {
Expand Down

0 comments on commit 68290a1

Please sign in to comment.