Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

94 lines (82 sloc) 3.386 kb
<!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>
Jump to Line
Something went wrong with that request. Please try again.