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
/
solving_for_the_y-intercept.html
93 lines (82 loc) · 3.31 KB
/
solving_for_the_y-intercept.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
<!DOCTYPE html>
<html data-require="math graphie math-format">
<head>
<meta charset="UTF-8" />
<title>Solving for the y-intercept</title>
<script src="../khan-exercise.js"></script>
<script type="text/javascript">
function p1Position( x1, y1, x2, y2 ) {
if ( ( y1 > y2 ) && ( x1 > x2 ) ) {
return "below right";
} else if ( ( y1 > y2 ) && ( x1 < x2 ) ) {
return "below left";
} else if ( ( y1 < y2 ) && ( x1 < x2 ) ) {
return "above left";
} else {
return "above right";
}
}
</script>
</head>
<body>
<div class="exercise">
<div class="vars" data-ensure="X2 !== X1 && Y2 !== Y1 && X_MAX >= 0 && X_MIN <= 0 && Y_MAX >= 0 && Y_MIN <= 0">
<var id="X1">randRangeNonZero(-10, 10)</var>
<var id="X2">randRangeNonZero(-10, 10)</var>
<var id="Y1">randRangeNonZero(-10, 10)</var>
<var id="Y2">randRangeNonZero(-10, 10)</var>
<var id="X_MARGIN">abs(X1 - X2)/2</var>
<var id="Y_MARGIN">abs(Y1 - Y2)/2</var>
<var id="X_MAX">max(X1, X2) + X_MARGIN</var>
<var id="X_MIN">min(X1, X2) - X_MARGIN</var>
<var id="Y_MAX">max(Y1, Y2) + Y_MARGIN</var>
<var id="Y_MIN">min(Y1, Y2) - Y_MARGIN</var>
<var id="SLOPE_NUMERATOR">Y1 - Y2</var>
<var id="SLOPE_DENOMINATOR">X1 - X2</var>
<var id="M">SLOPE_NUMERATOR / SLOPE_DENOMINATOR</var>
<var id="B">Y1 - (X1 * M)</var>
</div>
<div class="problems">
<div>
<div class="problem">
<p>The following line passes through point <code>(<var>X1</var>, <var>Y1</var>)</code>:</p>
<p><code>y = <var>fractionReduce( SLOPE_NUMERATOR, SLOPE_DENOMINATOR )</var> x + b</code></p>
</div>
<p class="question">What is the value of the <code>y</code>-intercept <code>b</code>?</p>
<p class="solution"><var>(Y1 * SLOPE_DENOMINATOR - X1 * SLOPE_NUMERATOR) / SLOPE_DENOMINATOR</var></p>
</div>
</div>
<div class="hints">
<p>Substituting <code>(<var>X1</var>, <var>Y1</var>)</code> into the equation gives:</p>
<p><code><var>Y1</var> = <var>fractionReduce( SLOPE_NUMERATOR, SLOPE_DENOMINATOR )</var> \cdot <var>X1</var> + b</code></p>
<p><code><var>Y1</var> = <var>fractionReduce( X1*SLOPE_NUMERATOR , SLOPE_DENOMINATOR )</var> + b</code></p>
<p><code>b = <var>Y1</var> - <var>fractionReduce( X1*SLOPE_NUMERATOR , SLOPE_DENOMINATOR )</var></code></p>
<p><code>b = <var>fractionReduce( Y1 * SLOPE_DENOMINATOR - X1 * SLOPE_NUMERATOR, SLOPE_DENOMINATOR )</var></code></p>
<div>
<p>Plugging in <code><var>fractionReduce( Y1 * SLOPE_DENOMINATOR - X1 * SLOPE_NUMERATOR, SLOPE_DENOMINATOR )</var></code> for <code>b</code>, we get <code>y = <var>fractionReduce( SLOPE_NUMERATOR, SLOPE_DENOMINATOR )</var> x + <var>fractionReduce(Y1*SLOPE_DENOMINATOR-X1*SLOPE_NUMERATOR,SLOPE_DENOMINATOR)</var></code>.</p>
<div class="graphie">
graphInit({
range: max( abs(B) + 4 , 11 ),
scale: 20,
tickStep: 1,
labelStep: 1,
unityLabels: false,
labelFormat: function( s ) { return "\\small{" + s + "}"; },
axisArrows: "<->"
});
plot(function( x ) {
return M * x + B;
}, [min( ( -abs(B) -5 ), -12) , max( ( abs(B)+5 ), 12 )], {
stroke: "#28ae7b"
});
circle( [X1, Y1], 3/20, {
stroke: "none",
fill: "black"
} );
label( [X1, Y1], "(" + X1 + ", " + Y1 + ")", p1Position( X1, Y1, X2, Y2 ) );
</div>
</div>
</div>
</div>
</body>
</html>