Permalink
Browse files

Add exercise: Solutions to quadratic equations

Reviewers: mark

Reviewed By: mark

Differential Revision: http://phabricator.khanacademy.org/D569
  • Loading branch information...
beneater committed Aug 10, 2012
1 parent 2894325 commit 4a5168aeeda4e8f4af4910adb4f6f28579ba7649
Showing with 151 additions and 0 deletions.
  1. +151 −0 exercises/solutions_to_quadratic_equations.html
@@ -0,0 +1,151 @@
+<!DOCTYPE html>
+<html data-require="math math-format graphie khanscript">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Solutions to quadratic equations</title>
+ <script src="../khan-exercise.js"></script>
+</head>
+<body>
+ <div class="exercise">
+ <div class="problems">
+ <div id="one-rational">
+ <div class="vars">
+ <var id="ANSWER">"One rational solution"</var>
+ <var id="B">randRangeNonZero(-6, 6) * 2</var>
+ <var id="A">randFromArray(getFactors(B * B / 4))</var>
+ <var id="C">(B * B) / (4 * A)</var>
+ <var id="DISCRIMINANT">B * B - 4 * A * C</var>
+ </div>
+
+ <p class="question">
+ Describe the solutions to the following quadratic equation:
+ </p>
+ <div class="problem">
+ <code><var>
+ expr(["+",
+ ["*", A, ["^", "x", 2]],
+ ["*", B, "x"],
+ C])
+ </var> = 0</code>
+ </div>
+
+ <div class="solution"><var>ANSWER</var></div>
+ <ul class="choices" data-category="true">
+ <li>One rational solution</li>
+ <li>Two rational solutions</li>
+ <li>Two irrational solutions</li>
+ <li>One complex solution</li>
+ <li>Two complex solutions</li>
+ </ul>
+
+ <div class="hints">
+ <div>
+ <p>
+ We could use the quadratic formula to solve for the
+ solutions and see what they are, but there's a
+ shortcut...
+ </p>
+ <p><code id="quadratic">\qquad
+ x = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}
+ </code>
+ </div>
+ <div>
+ <script type="text/khanscript">
+ $("#quadratic").text("\\qquad x = \\dfrac{-b \\pm" +
+ " \\sqrt{\\blue{b^2 - 4ac}}}{2a}");
+ MathJax.Hub.Queue(["Reprocess", MathJax.Hub,
+ $("#quadratic")[0]]);
+ </script>
+ <div>
+ Think about what the part of the quadratic
+ formula <span class="hint_blue">under the
+ radical</span> tells us about the solutions.
+ </div>
+ </div>
+ <div>
+ <p>
+ Substitute the <code>a</code>, <code>b</code>, and
+ <code>c</code> coefficients from the quadratic
+ equation:
+ </p>
+ <p>
+ <code>\qquad\begin{array}
+ &amp;&amp; b^2-4ac \\ \\
+ =&amp; <var>B</var>^2 - 4 (
+ <var>A</var>)(<var>C</var>) \\ \\
+ =&amp; <var>DISCRIMINANT</var>
+ \end{array}
+ </code>
+ </p>
+ </div>
+ <p data-if="ANSWER === 'One rational solution'">
+ Because <code>\blue{b^2 - 4ac} = 0</code>, then the
+ quadratic formula reduces to
+ <code>\dfrac{-b}{2a}</code>, which means there
+ is just one rational solution.
+ </p>
+ <p data-else-if="ANSWER === 'Two complex solutions'">
+ Because <code>\blue{b^2 - 4ac}</code> is negative, its
+ square is imaginary and the quadratic formula reduces to
+ <code>\dfrac{-b \pm \sqrt{<var>DISCRIMINANT</var>}}{2a}
+ </code>, which means there are two complex solutions.
+ </p>
+ <p data-else-if="ANSWER === 'Two rational solutions'">
+ Because <code>\blue{b^2 - 4ac}</code> is a perfect
+ square, its square root is rational and the
+ quadratic formula reduces to
+ <code>\dfrac{-b \pm <var>sqrt(DISCRIMINANT)</var>}{2a}
+ </code>, which means there are two rational solutions.
+ </p>
+ <p data-else>
+ Because <code>\blue{b^2 - 4ac}</code> is not a perfect
+ square, its square root is irrational and the
+ quadratic formula reduces to
+ <code>\dfrac{-b \pm \sqrt{<var>DISCRIMINANT</var>}}{2a}
+ </code>, which means there are two irrational solutions.
+ </p>
+ </div>
+ </div>
+
+ <div id="two-rational" data-type="one-rational">
+ <div class="vars" data-apply="replace">
+ <var id="ANSWER">"Two rational solutions"</var>
+ <div data-ensure="DISCRIMINANT > 0 &&
+ sqrt(DISCRIMINANT) - floor(sqrt(DISCRIMINANT)) < 0.001
+ && DISCRIMINANT <= 144">
+ <var id="A">randRangeNonZero(-9, 9)</var>
+ <var id="B">randRangeNonZero(-9, 9)</var>
+ <var id="C">randRangeNonZero(-9, 9)</var>
+ <var id="DISCRIMINANT">B * B - 4 * A * C</var>
+ </div>
+ </div>
+ </div>
+
+ <div id="two-irrational" data-type="one-rational">
+ <div class="vars" data-apply="replace">
+ <var id="ANSWER">"Two irrational solutions"</var>
+ <div data-ensure="DISCRIMINANT > 0 &&
+ sqrt(DISCRIMINANT) - floor(sqrt(DISCRIMINANT)) > 0.001">
+ <var id="A">randRangeNonZero(-9, 9)</var>
+ <var id="B">randRangeNonZero(-9, 9)</var>
+ <var id="C">randRangeNonZero(-9, 9)</var>
+ <var id="DISCRIMINANT">B * B - 4 * A * C</var>
+ </div>
+ </div>
+ </div>
+
+ <div id="two-complex" data-type="one-rational">
+ <div class="vars" data-apply="replace">
+ <var id="ANSWER">"Two complex solutions"</var>
+ <div data-ensure="DISCRIMINANT < 0">
+ <var id="A">randRangeNonZero(-9, 9)</var>
+ <var id="B">randRangeNonZero(-9, 9)</var>
+ <var id="C">randRangeNonZero(-9, 9)</var>
+ <var id="DISCRIMINANT">B * B - 4 * A * C</var>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</body>
+</html>

0 comments on commit 4a5168a

Please sign in to comment.