Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 352 lines (338 sloc) 20.149 kb
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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352
<!DOCTYPE html>
<html data-require="math math-format expressions graphie interactive">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Graphing and solving linear inequalities</title>
    <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
    <div class="problems">
        <div>
            <div class="vars">
                <var id="SLOPE_FRAC">reduce( randRangeNonZero( -5, 5 ), randRange( 1, 5 ) )</var>
                <var id="YINT">randRangeNonZero( max( -10, -10 - SLOPE_FRAC[0] ), min( 10, 10 - SLOPE_FRAC[0] ) )</var>
                <var id="SLOPE">SLOPE_FRAC[0] / SLOPE_FRAC[1]</var>
                <var id="PRETTY_SLOPE">SLOPE === 1 ? "" : ( SLOPE === -1 ? "-" : fraction( SLOPE_FRAC[0], SLOPE_FRAC[1], true, true ) )</var>
                <var id="MULT">randRangeNonZero( -3, 3 )</var>
                <var id="A">SLOPE_FRAC[0] * -MULT</var>
                <var id="B">SLOPE_FRAC[1] * MULT</var>
                <var id="C">SLOPE_FRAC[1] * YINT * MULT</var>
                <var id="STD_FORM">randFromArray([ true, false ])</var>
                <var id="COMP">randFromArray([ "&lt;", "&gt;", "≤", "≥" ])</var>
                <var id="STD_FORM_COMP">B &lt; 0 ? { "&lt;": "&gt;", "&gt;": "&lt;", "≤": "≥", "≥": "≤" }[ COMP ] : COMP</var>
                <var id="LESS_THAN">COMP === "&lt;" || COMP === "≤"</var>
                <var id="INCLUSIVE">COMP === "≥" || COMP === "≤"</var>
                <div data-ensure="sqrt( pow( POINT_1[0] - POINT_2[0], 2 ) + pow( POINT_1[1] - POINT_2[1], 2 ) ) &gt; 4">
                    <var id="POINT_1">[ randRangeExclude( -9, 9, [ -3, -2, -1, 0 ] ), randRangeExclude( -9, 9, [ -1, -2 ] ) ]</var>
                    <var id="POINT_2">[ randRangeExclude( -9, 9, [ -3, -2, -1, 0 ] ), randRangeExclude( -9, 9, [ -1, -2 ] ) ]</var>
                    <var id="POINT_1_SOLUTION">
                            (((COMP === "&lt;") &amp;&amp; ( POINT_1[1] &lt; SLOPE * POINT_1[0] + YINT ))
                        || ((COMP === "≤") &amp;&amp; ( POINT_1[1] &lt;= SLOPE * POINT_1[0] + YINT ))
                        || ((COMP === "&gt;") &amp;&amp; ( POINT_1[1] &gt; SLOPE * POINT_1[0] + YINT ))
                        || ((COMP === "≥") &amp;&amp; ( POINT_1[1] &gt;= SLOPE * POINT_1[0] + YINT )))
                    </var>
                    <var id="POINT_2_SOLUTION">
                            (((COMP === "&lt;") &amp;&amp; ( POINT_2[1] &lt; SLOPE * POINT_2[0] + YINT ))
                        || ((COMP === "≤") &amp;&amp; ( POINT_2[1] &lt;= SLOPE * POINT_2[0] + YINT ))
                        || ((COMP === "&gt;") &amp;&amp; ( POINT_2[1] &gt; SLOPE * POINT_2[0] + YINT ))
                        || ((COMP === "≥") &amp;&amp; ( POINT_2[1] &gt;= SLOPE * POINT_2[0] + YINT )))
                    </var>
                </div>
            </div>

            <p class="question">
                Graph the following inequality and determine if the points
                <code>(<var>POINT_1[0]</var>, <var>POINT_1[1]</var>)</code> or
                <code>(<var>POINT_2[0]</var>, <var>POINT_2[1]</var>)</code> are solutions:
            </p>

            <div class="problem">
                <p class="hint_blue" data-if="STD_FORM">
                    <code><var>expr([ "+", [ "*", A, "x" ], [ "*", B, "y" ] ])</var> <var>STD_FORM_COMP</var> <var>C</var></code>
                </p>
                <p class="hint_blue" data-else="">
                    <code>y <var>COMP</var> <var>PRETTY_SLOPE</var> x + <var>YINT</var></code>
                </p>

                <form>
                    <input onclick="javascript:
KhanUtil.currentGraph.graph.shadetop = !KhanUtil.currentGraph.graph.shadetop;
KhanUtil.currentGraph.graph.update();
" type="button" value="Shade other side">
                    <label>
                        <input checked name="dashradio" onclick="javascript:
KhanUtil.currentGraph.graph.dasharray = '';
KhanUtil.currentGraph.graph.update();
" type="radio" value="solid">
                        Solid line
                    </label>
                    <label>
                        <input name="dashradio" onclick="javascript:
KhanUtil.currentGraph.graph.dasharray = '- ';
KhanUtil.currentGraph.graph.update();
" type="radio" value="dashed">
                        Dashed line
                    </label>
                </form>
                <div class="graphie" id="grid">
                    graphInit({
                        range: 11,
                        scale: 20,
                        axisArrows: "&lt;-&gt;",
                        tickStep: 1,
                        labelStep: 1,
                        gridOpacity: 0.05,
                        axisOpacity: 0.2,
                        tickOpacity: 0.4,
                        labelOpacity: 0.5
                    });

                    label( [ 0, -11 ], "y", "below" );
                    label( [ 11, 0 ], "x", "right" );

                    addMouseLayer();
                    graph.pointA = addMovablePoint({
                        coord: [ -5, 5 ],
                        snapX: 0.5,
                        snapY: 0.5,
                        normalStyle: {
                            stroke: KhanUtil.BLUE,
                            fill: KhanUtil.BLUE
                        }
                    });
                    graph.pointB = addMovablePoint({
                        coord: [ 5, 5 ],
                        snapX: 0.5,
                        snapY: 0.5,
                        normalStyle: {
                            stroke: KhanUtil.BLUE,
                            fill: KhanUtil.BLUE
                        }
                    });
                    graph.line1 = bogusShape;
                    graph.shading = bogusShape;

                    graph.update = function() {
                        graph.line1.remove();
                        graph.shading.remove();
                        if ( abs( graph.pointB.coord[0] - graph.pointA.coord[0] ) &gt; 0.001 ) {
                            var slope = ( graph.pointB.coord[1] - graph.pointA.coord[1] ) / ( graph.pointB.coord[0] - graph.pointA.coord[0] );
                            var yint = slope * ( 0 - graph.pointA.coord[0] ) + graph.pointA.coord[1];
                            var shadeEdge = ( ( graph.pointA.coord[0] &lt; graph.pointB.coord[0] ) ? graph.shadetop : !graph.shadetop ) ? 11 : -11;
                            style({ stroke: BLUE, strokeWidth: 2, strokeDasharray: graph.dasharray }, function() {
                                graph.line1 = line( [ -11, -11 * slope + yint ], [ 11, 11 * slope + yint ] ).toBack();
                            });
                            style({ fill: BLUE, stroke: null, opacity: KhanUtil.FILL_OPACITY }, function() {
                                graph.shading = path([ [ 11, shadeEdge ], [ 11, 11 * slope + yint ], [ -11, -11 * slope + yint ], [ -11, shadeEdge ] ]);
                            });

                        } else {
                            // vertical line
                            var x = graph.pointA.coord[0];
                            var shadeEdge = ( ( graph.pointB.coord[1] &lt; graph.pointA.coord[1] ) ? graph.shadetop : !graph.shadetop ) ? 11 : -11;
                            style({ stroke: BLUE, strokeWidth: 2, strokeDasharray: graph.dasharray }, function() {
                                graph.line1 = line( [ x, -11 ], [ x, 11 ] ).toBack();
                            });
                            style({ fill: BLUE, stroke: null, opacity: KhanUtil.FILL_OPACITY }, function() {
                                graph.shading = path([ [ x, -11 ], [ x, 11 ], [ shadeEdge, 11 ], [ shadeEdge, -11 ] ]);
                            });
                        }
                        graph.pointA.toFront();
                        graph.pointB.toFront();
                    };

                    // A and B can't be in the same place
                    graph.pointA.onMove = function( x, y ) {
                        if ( x != graph.pointB.coord[0] || y != graph.pointB.coord[1] ) {
                            graph.pointA.setCoord([ x, y ]);
                            graph.update();
                            return true;
                        } else {
                            return false;
                        }
                    }
                    graph.pointB.onMove = function( x, y ) {
                        if ( x != graph.pointA.coord[0] || y != graph.pointA.coord[1] ) {
                            graph.pointB.setCoord([ x, y, ]);
                            graph.update();
                            return true;
                        } else {
                            return false;
                        }
                    }

                    graph.dasharray = "";
                    graph.shadetop = true;
                    graph.update();
                    graph.pointA.toFront();
                    graph.pointB.toFront();

                </div>

            </div>
            <div class="solution" data-type="multiple">
                <div class="sol" data-type="custom">
                    <div class="instruction">
                        Drag the two points to move the line into the correct position.
                    </div>
                    <div class="guess">[ graph.pointA.coord, graph.pointB.coord,
                        graph.pointA.coord[0] &gt; graph.pointB.coord[0] ? graph.shadetop : !graph.shadetop,
                        graph.dasharray === "- " ? false : true ]
                    </div>
                    <div class="validator-function">
                        if (_.isEqual(guess, [[-5, 5], [5, 5], false, true])) {
                            return "";
                        }

                        var slope = ( guess[1][1] - guess[0][1] ) / ( guess[1][0] - guess[0][0] );
                        var yint = slope * ( 0 - guess[0][0] ) + guess[0][1];
                        return abs( SLOPE - slope ) &lt; 0.001
                            &amp;&amp; abs( YINT - yint ) &lt; 0.001
                            &amp;&amp; guess[2] === LESS_THAN
                            &amp;&amp; guess[3] === INCLUSIVE;
                    </div>
                    <div class="show-guess">
                        graph.pointA.setCoord( guess[0] );
                        graph.pointB.setCoord( guess[1] );
                        graph.shadetop = graph.pointA.coord[0] &gt; graph.pointB.coord[0] ? guess[2] : !guess[2];
                        if ( guess[3] ) {
                            graph.dasharray = "";
                            $( "input[name=dashradio][value=solid]" ).attr( "checked", true );
                        } else {
                            graph.dasharray = "- ";
                            $( "input[name=dashradio][value=dashed]" ).attr( "checked", true );
                        }
                        graph.update();
                    </div>
                </div>
                <div><label><span class="sol" data-type="checkbox"><var>POINT_1_SOLUTION</var></span><code>(<var>POINT_1[0]</var>, <var>POINT_1[1]</var>)</code> is a solution</label></div>
                <div><label><span class="sol" data-type="checkbox"><var>POINT_2_SOLUTION</var></span><code>(<var>POINT_2[0]</var>, <var>POINT_2[1]</var>)</code> is a solution</label></div>
                <div class="example">graph the inequality</div>
                <div class="example">make sure the correct side is shaded</div>
                <div class="example">make sure the line is correctly shown as solid or dashed</div>
            </div>
        </div>
    </div>

    <div class="hints">
        <div data-if="STD_FORM" data-unwrap="">
            <p>
                Convert <code><var>expr([ "+", [ "*", A, "x" ], [ "*", B, "y" ] ])</var> <var>STD_FORM_COMP</var> <var>C</var></code>
                to slope-intercept form by solving for <code>y</code>.
            </p>
            <div>
                <p data-if="A < 0">
                    Add <code><var>abs( A )</var>x</code> to both sides:
                </p><p data-else="">
                    Subtract <code><var>abs( A )</var>x</code> from both sides:
                </p><p>
                    <code>\qquad <var>expr( [ "*", B, "y" ] )</var> <var>STD_FORM_COMP</var> <var>expr([ "+", [ "*", -A, "x" ], C ])</var></code>
                </p>
            </div>
            <div data-if="B !== 1">
                <p>
                    Divide both sides by <code><var>B</var></code><span data-if="B < 0">. Since you're multiplying or dividing by a negative number, <strong>don't forget</strong> to flip the inequality sign</span>:
                </p><p>
                    <code>\qquad y <var>COMP</var> <var>expr([ "+", "\\dfrac{" + expr([ "*", -A, "x" ]) + "}{" + B + "}", "\\dfrac{" + C + "}{" + B + "}" ])</var></code>
                </p>
            </div>
        </div>
        <div>
            <p>
                <code>\qquad y <var>COMP</var> \color{purple}{<var>PRETTY_SLOPE</var>} x \color{<var>GREEN</var>}{+ <var>YINT</var>}</code>
            </p><p>
                The y-intercept is <code class="hint_green"><var>YINT</var></code> and the slope is <code class="hint_purple"><var>decimalFraction( SLOPE, true, true )</var></code>.
                Since the y-intercept is <code class="hint_green"><var>YINT</var></code>, the line must pass through the point <code class="hint_green">(0, <var>YINT</var>)</code>.
            </p>
            <div class="graphie" data-update="grid">
                style({ stroke: GREEN, fill: GREEN }, function() {
                    graph.yint = circle( [ 0, YINT ], 0.2 ).toBack();
                });
            </div>
        </div>
        <div>
            <p>
                <span>The slope is <code class="hint_purple"><var>decimalFraction( SLOPE, true, true )</var></code>. Remember that
                the slope tells you rise over run.</span>
                <span data-if="abs( SLOPE_FRAC[0] ) !== 1">
                For every step we take we must move
                <code><var>abs( SLOPE_FRAC[0] )</var></code>
                positions
                <span data-if="SLOPE_FRAC[0] < 0"><em>down</em> (because it's negative)</span><span data-else="">up</span>.</span><span data-else="">
                For every step we take we must move
                <code><var>abs( SLOPE_FRAC[0] )</var></code>
                position
                <span data-if="SLOPE_FRAC[0] < 0"><em>down</em> (because it's negative)</span><span data-else="">up</span>.</span>
                <span data-if="abs( SLOPE_FRAC[1] ) !== 1">
                For every step we take we must also move
                <code><var>SLOPE_FRAC[1]</var></code>
                positions
                to the right.</span><span data-else="">
                For every step we take we must also move
                <code><var>SLOPE_FRAC[1]</var></code>
                position
                to the right.</span>
                <span>So the line must also pass through <code class="hint_purple">(<var>SLOPE_FRAC[1]</var>, <var>YINT + SLOPE_FRAC[0]</var>)</code>.</span>
            </p>
            <div class="graphie" data-update="grid">
                style({
                    stroke: "purple",
                    strokeWidth: 2,
                    arrows: "-&gt;"
                }, function() {
                    path([ [ 0, YINT ], [ 0, YINT + SLOPE_FRAC[0] ] ]).toBack();
                    path([ [ 0, YINT + SLOPE_FRAC[0] ], [ SLOPE_FRAC[1], YINT + SLOPE_FRAC[0] ] ]).toBack();
                });
                label( [ 0, YINT + SLOPE_FRAC[0] / 2 ], abs( SLOPE_FRAC[0] ) + " \\text{ " + ( SLOPE_FRAC[0] &lt; 0 ? $._("down") : $._("up") ) + "} \\quad", "left", { color: "purple" } );
                label( [ 0, YINT + SLOPE_FRAC[0] ], SLOPE_FRAC[1] + " \\text{ " + $._("right") + "}", ( SLOPE_FRAC[0] &lt; 0 ? "below right" : "above right" ), { color: "purple" } );
                graph.yint.toBack();
            </div>
        </div>
        <p data-if="LESS_THAN">
            Since our inequality has a less-than<span data-if="INCLUSIVE"> or equal to</span> sign, that means that any point
            <strong>below</strong> the line is a solution to the inequality, so the area below
            the line should be shaded.
        </p><p data-else="">
            Since our inequality has a greater-than<span data-if="INCLUSIVE"> or equal to</span> sign, that means that any point
            <strong>above</strong> the line is a solution to the inequality, so the area above
            the line should be shaded.
        </p>
        <div>
            <p data-if="INCLUSIVE"><span data-if="LESS_THAN" data-unwrap="">
                Note that since the sign is less-than or <strong>equal to</strong>, any point on the line is also a solution, so the
                line should be solid.
            </span><span data-else="" data-unwrap="">
                Note that since the sign is greater-than or <strong>equal to</strong>, any point on the line is also a solution, so the
                line should be solid.
            </span></p>
            <p data-else=""><span data-if="LESS_THAN" data-unwrap="">
                Note that since the sign is less-than (and not equal to), any point on the line is <strong>not</strong> part of the solution,
                so the line should be dashed to indicate this.
            </span><span data-else="" data-unwrap="">
                Note that since the sign is greater-than (and not equal to), any point on the line is <strong>not</strong> part of the solution,
                so the line should be dashed to indicate this.
            </span></p>
        </div>
        <div>
            <p>
                Plot each of the points to determine which are solutions:
                <code class="hint_pink">(<var>POINT_1[0]</var>, <var>POINT_1[1]</var>)</code> and
                <code class="hint_pink">(<var>POINT_2[0]</var>, <var>POINT_2[1]</var>)</code>
            </p>
            <div class="graphie" data-update="grid">
                style({ stroke: PINK, fill: PINK }, function() {
                    circle( [ POINT_1[0], POINT_1[1] ], 0.2 ).toBack();
                    circle( [ POINT_2[0], POINT_2[1] ], 0.2 ).toBack();
                });
            </div>
        </div>
        <div>
            <p data-if="POINT_1_SOLUTION && !POINT_2_SOLUTION">
                <code class="hint_pink">(<var>POINT_1[0]</var>, <var>POINT_1[1]</var>)</code> is a solution because it's inside the shaded area, but
                <code class="hint_pink">(<var>POINT_2[0]</var>, <var>POINT_2[1]</var>)</code> is not.
            </p>
            <p data-else-if="POINT_2_SOLUTION &amp;&amp; !POINT_1_SOLUTION">
                <code class="hint_pink">(<var>POINT_1[0]</var>, <var>POINT_1[1]</var>)</code> is outside the shaded area, so it's not a solution, but
                <code class="hint_pink">(<var>POINT_2[0]</var>, <var>POINT_2[1]</var>)</code> is a solution.
            </p>
            <p data-else-if="POINT_1_SOLUTION &amp;&amp; POINT_2_SOLUTION"> Both
                <code class="hint_pink">(<var>POINT_1[0]</var>, <var>POINT_1[1]</var>)</code> and
                <code class="hint_pink">(<var>POINT_2[0]</var>, <var>POINT_2[1]</var>)</code> are solutions because they're inside the shaded area.
            </p>
            <p data-else=""> Neither
                <code class="hint_pink">(<var>POINT_1[0]</var>, <var>POINT_1[1]</var>)</code> nor
                <code class="hint_pink">(<var>POINT_2[0]</var>, <var>POINT_2[1]</var>)</code> are solutions because they are not within the shaded area.
            </p>
        </div>
    </div>

</div>
</body>
</html>
Something went wrong with that request. Please try again.