This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 863
/
completing_the_square_2.html
102 lines (102 loc) · 6.17 KB
/
completing_the_square_2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html data-require="math polynomials expressions math-format">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Completing the square 2</title>
<script src="../khan-exercise.js"></script>
<style type="text/css">
#answer_area .short input[type=text] {
width: 60px;
}
</style>
</head>
<body>
<div class="exercise">
<div class="problems">
<div id="original" data-weight="4">
<div class="vars">
<var id="X1">randRange( 1, 4 ) / randRangeNonZero( -2, 2 )</var>
<var id="X2" data-ensure="X1 !== X2">( randRange( -3, 3 ) * 2 + 1 ) / 2</var>
<var id="B">( X1 + X2 ) * -1</var>
<var id="B_SIGN">B > 0 ? "+" : "-"</var>
<var id="C">X1 * X2</var>
<var id="MULT">getLCM( toFraction( B )[1], toFraction( C )[1] )</var>
<var id="POLY">new Polynomial( 0, 2, [MULT*C, MULT*B, MULT], "x" )</var>
<var id="POLY_TEXT">POLY.text()</var>
</div>
<p class="question">Solve for <code>x</code> by completing the square.</p>
<p><code><var>POLY_TEXT</var> = 0</code></p>
<div class="solution" data-type="set">
<div class="set-sol"><var>X1</var></div>
<div class="set-sol"><var>X2</var></div>
<div class="input-format">
<p><code>x = {}</code><span class="entry short"></span><code>\quad \text{or} \quad x = {}</code><span class="entry short"></span></p>
</div>
<p class="example">integers, like <code>6</code></p>
<p class="example"><em>simplified proper</em> fractions, like <code>3/5</code></p>
<p class="example"><em>simplified improper</em> fractions, like <code>7/4</code></p>
<p class="example">and/or <em>exact</em> decimals, like <code>0.75</code></p>
</div>
</div>
<div id="one-root" data-type="original" data-weight="1">
<div class="vars">
<var id="X1">( randRange( -4, 4 ) * 2 + 1 ) / 2</var>
<var id="X2">X1</var>
</div>
<div class="solution" data-type="multiple">
<p><code>x = {}</code><span class="sol"><var>X1</var></span></p>
<p class="example">integers, like <code>6</code></p>
<p class="example"><em>simplified proper</em> fractions, like <code>3/5</code></p>
<p class="example"><em>simplified improper</em> fractions, like <code>7/4</code></p>
<p class="example">and/or <em>exact</em> decimals, like <code>0.75</code></p>
</div>
</div>
<div id="odds" data-type="original" data-weight="2">
<div class="vars">
<var id="X1">randRangeNonZero( -8, 8 )</var>
<var id="X2">randRange( -4, 4 ) * 2 + ( X1 % 2 - 1 )</var>
</div>
</div>
</div>
<div class="hints">
<div data-if="MULT !== 1">
<p>First, divide the polynomial by <code><var>MULT</var></code>, the coefficient of the <code>x^2</code> term.</p>
<p><code>x^2 <span data-if="B !== 0"><span data-if="abs( B ) !== 1"> + <var>decimalFraction( B, 1, 1 )</var></span><span data-else><var>B_SIGN</var></span>x</span> + <var>decimalFraction( C, 1, 1 )</var> = 0</code></p>
</div>
<div data-if="X1 !== X2" data-unwrap>
<div data-if="C !== 0">
<p>Move the constant term to the right side of the equation.</p>
<p><code>x^2 <span data-if="B !== 0"><span data-if="abs( B ) !== 1"> + <var>decimalFraction( B, 1, 1 )</var></span><span data-else><var>B_SIGN</var></span>x</span> = <var>decimalFraction( C * -1, 1, 1 )</var></code></p>
</div>
<div data-if="B !== 0">
<p>We complete the square by taking half of the coefficient of our <code>x</code> term, squaring it, and adding it to both sides of the equation. The coefficient of our <code>x</code> term is <code><var>decimalFraction( B, 1, 1 )</code></var>, so half of it would be <code><var>decimalFraction( B / 2, 1, 1 )</var></code>, and squaring it gives us <code>\color{blue}{<var>decimalFraction( pow( B / 2, 2 ), 1, 1 )</var>}</code>.</p>
<p><code>x^2 <span data-if="abs( B ) !== 1"> + <var>decimalFraction( B, 1, 1 )</var></span><span data-else><var>B_SIGN</var></span>x \color{blue}{ + <var>decimalFraction( pow( B / 2, 2 ), 1, 1 )</var>} = <var>decimalFraction( C * -1, 1, 1 )</var> \color{blue}{ + <var>decimalFraction( pow( B / 2, 2 ), 1, 1 )</var>}</code></p>
</div>
<div data-if="B !== 0">
<p>We can now rewrite the left side of the equation as a squared term.</p>
<p><code>( x + <var>decimalFraction( B / 2, 1, 1 )</var> )^2 = <var>decimalFraction( C * -1 + pow( B / 2, 2 ), 1, 1 )</var></code></p>
</div>
</div>
<div data-else data-unwrap>
<p>Note that the left side of the equation is already a perfect square trinomial. The coefficient of our <code>x</code> term is <code><var>decimalFraction( B, 1, 1 )</code></var>, half of it is <code><var>decimalFraction( B / 2, 1, 1 )</var></code>, and squaring it gives us <code>\color{blue}{<var>decimalFraction( pow( B / 2, 2 ), 1, 1 )</var>}</code>, our constant term.</p>
<div>
<p>Thus, we can rewrite the left side of the equation as a squared term.</p>
<p><code>( x + <var>decimalFraction( B / 2, 1, 1 )</var> )^2 = <var>decimalFraction( C * -1 + pow( B / 2, 2 ), 1, 1 )</var></code></p>
</div>
</div>
<div>
<p>Take the square root of both sides.</p>
<p><code>x <span data-if="B !== 0"> + <var>decimalFraction( B / 2, 1, 1 )</var></span> = <span data-if="sqrt( C * -1 + pow( B / 2, 2 ) ) !== 0">\pm</span><var>decimalFraction( sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )</var></code></p>
</div>
<div data-if="B !== 0">
<p>Isolate <code>x</code> to find the solution(s).</p>
<p data-if="sqrt( C * -1 + pow( B / 2, 2 ) ) !== 0"><code>x = <var>decimalFraction( -B / 2, 1, 1 )</var>\pm<var>decimalFraction( sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )</var></code></p>
<p><code>x = <var>decimalFraction( -B / 2 + sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )</var><span data-if="sqrt( C * -1 + pow( B / 2, 2 ) ) !== 0"> \text{ or } x = <var>decimalFraction( -B / 2 - sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )</var></span></code></p>
</div>
<div data-else>
<p><code>x = <var>decimalFraction( -B / 2 + sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )</var><span data-if="sqrt( C * -1 + pow( B / 2, 2 ) ) !== 0"> \text{ or } x = <var>decimalFraction( -B / 2 - sqrt( C * -1 + pow( B / 2, 2 ) ), 1, 1 )</var></span></code></p>
</div>
</div>
</div>
</body>
</html>