reduce( randRangeNonZero( -5, 5 ), randRange( 1, 5 ) ) randRangeNonZero( max( -10, -10 - SLOPE_FRAC[0] ), min( 10, 10 - SLOPE_FRAC[0] ) ) SLOPE_FRAC[0] / SLOPE_FRAC[1] SLOPE === 1 ? "" : ( SLOPE === -1 ? "-" : fraction( SLOPE_FRAC[0], SLOPE_FRAC[1], true, true ) ) randRangeNonZero( -3, 3 ) SLOPE_FRAC[0] * -MULT SLOPE_FRAC[1] * MULT SLOPE_FRAC[1] * YINT * MULT randFromArray([ true, false ]) randFromArray([ "<", ">", "≤", "≥" ]) B < 0 ? { "<": ">", ">": "<", "≤": "≥", "≥": "≤" }[ COMP ] : COMP COMP === "<" || COMP === "≤" COMP === "≥" || COMP === "≤"
[ randRangeExclude( -9, 9, [ -3, -2, -1, 0 ] ), randRangeExclude( -9, 9, [ -1, -2 ] ) ] [ randRangeExclude( -9, 9, [ -3, -2, -1, 0 ] ), randRangeExclude( -9, 9, [ -1, -2 ] ) ] (((COMP === "<") && ( POINT_1[1] < SLOPE * POINT_1[0] + YINT )) || ((COMP === "≤") && ( POINT_1[1] <= SLOPE * POINT_1[0] + YINT )) || ((COMP === ">") && ( POINT_1[1] > SLOPE * POINT_1[0] + YINT )) || ((COMP === "≥") && ( POINT_1[1] >= SLOPE * POINT_1[0] + YINT ))) (((COMP === "<") && ( POINT_2[1] < SLOPE * POINT_2[0] + YINT )) || ((COMP === "≤") && ( POINT_2[1] <= SLOPE * POINT_2[0] + YINT )) || ((COMP === ">") && ( POINT_2[1] > SLOPE * POINT_2[0] + YINT )) || ((COMP === "≥") && ( POINT_2[1] >= SLOPE * POINT_2[0] + YINT )))

Graph the following inequality and determine if the points (POINT_1[0], POINT_1[1]) or (POINT_2[0], POINT_2[1]) are solutions:

expr([ "+", [ "*", A, "x" ], [ "*", B, "y" ] ]) STD_FORM_COMP C

y COMP PRETTY_SLOPE x + YINT

graphInit({ range: 11, scale: 20, axisArrows: "<->", 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] ) > 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] < 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] < 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 ] ]); }); } }; // 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();
Drag the two points to move the line into the correct position.
[ graph.pointA.coord, graph.pointB.coord, graph.pointA.coord[0] > graph.pointB.coord[0] ? graph.shadetop : !graph.shadetop, graph.dasharray === "- " ? false : true ]
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 ) < 0.001 && abs( YINT - yint ) < 0.001 && guess[2] === LESS_THAN && guess[3] === INCLUSIVE;
graph.pointA.setCoord( guess[0] ); graph.pointB.setCoord( guess[1] ); graph.shadetop = graph.pointA.coord[0] > 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();


graph the inequality
make sure the correct side is shaded
make sure the line is correctly shown as solid or dashed

Convert expr([ "+", [ "*", A, "x" ], [ "*", B, "y" ] ]) STD_FORM_COMP C to slope-intercept form by solving for y.

A < 0 ? "Add" : "Subtract" abs( A )x A < 0 ? "to" : "from" both sides:

\qquad expr( [ "*", B, "y" ] ) STD_FORM_COMP expr([ "+", [ "*", -A, "x" ], C ])

Divide both sides by B. Since you're multiplying or dividing by a negative number, don't forget to flip the inequality sign:

\qquad y COMP expr([ "+", "\\dfrac{" + expr([ "*", -A, "x" ]) + "}{" + B + "}", "\\dfrac{" + C + "}{" + B + "}" ])

\qquad y COMP \color{purple}{PRETTY_SLOPE} x \color{GREEN}{+ YINT}

The y-intercept is YINT and the slope is decimalFraction( SLOPE, true, true ). Since the y-intercept is YINT, the line must pass through the point (0, YINT).

style({ stroke: GREEN, fill: GREEN }, function() { graph.yint = circle( [ 0, YINT ], 0.2 ).toBack(); });

The slope is decimalFraction( SLOPE, true, true ). Remember that the slope tells you rise over run. So in this case for every abs( SLOPE_FRAC[0] ) "position" + ( abs( SLOPE_FRAC[0] ) !== 1 ? "s" : "" ) you move down (because it's negative) up you must also move SLOPE_FRAC[1] "position" + ( abs( SLOPE_FRAC[1] ) !== 1 ? "s" : "" ) to the right. So the line must also pass through (SLOPE_FRAC[1], YINT + SLOPE_FRAC[0])

style({ stroke: "purple", strokeWidth: 2, arrows: "->" }, 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] < 0 ? "down" : "up" ) + "} \\quad", "left", { color: "purple" } ); label( [ 0, YINT + SLOPE_FRAC[0] ], SLOPE_FRAC[1] + " \\text{ right}", ( SLOPE_FRAC[0] < 0 ? "below right" : "above right" ), { color: "purple" } ); graph.yint.toBack();

Since our inequality has a LESS_THAN ? "less-than" : "greater-than"INCLUSIVE ? " or equal to" : "" sign, that means that any point LESS_THAN ? "below" : "above" the line is a solution to the inequality, so the area LESS_THAN ? "below" : "above" the line should be shaded.

Note that since the sign is LESS_THAN ? "less-than" : "greater-than" or equal to, any point on the line is also a solution, so the line should be solid.

Note that since the sign is LESS_THAN ? "less-than" : "greater-than" (and not equal to), any point on the line is not part of the solution, so the line should be dashed to indicate this.

Plot each of the points to determine which are solutions: (POINT_1[0], POINT_1[1]) and (POINT_2[0], POINT_2[1])

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(); });

(POINT_1[0], POINT_1[1]) is a solution because it's inside the shaded area, but (POINT_2[0], POINT_2[1]) is not.

(POINT_1[0], POINT_1[1]) is outside the shaded area, so it's not a solution, but (POINT_2[0], POINT_2[1]) is a solution.

Both (POINT_1[0], POINT_1[1]) and (POINT_2[0], POINT_2[1]) are solutions because they're inside the shaded area.

Neither (POINT_1[0], POINT_1[1]) nor (POINT_2[0], POINT_2[1]) are solutions because they are not within the shaded area.