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] fractionVariable(SLOPE_FRAC[0], SLOPE_FRAC[1], "x") 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 === "≤" (function() { // Create a point on the line var minN = floor(9 / abs(SLOPE_FRAC[1])); var n = randRange(-minN, minN); return [n * SLOPE_FRAC[1], YINT+ n * SLOPE_FRAC[0]]; })() randFromArray([ [randRangeExclude(-9, 9, [-3, -2, -1, 0]), randRangeExclude(-9, 9, [-1, -2])], [randRangeExclude(-9, 9, [-3, -2, -1, 0]), randRangeExclude(-9, 9, [-1, -2])], EDGE_POINT ]) POINT[1] === SLOPE * POINT[0] + YINT (function() { if (POINT_ON_LINE) { return INCLUSIVE; } return (POINT[1] < SLOPE * POINT[0] + YINT) ? LESS_THAN : !LESS_THAN; })()

Graph the following inequality:

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

y COMP PRETTY_SLOPE + YINT

graphInit({ range: 11, scale: 20, axisArrows: "<->", tickStep: 1, labelStep: 1, gridOpacity: 0.05, axisOpacity: 0.2, tickOpacity: 0.4, labelOpacity: 0.5 }); 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 ] ]); }); } 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();

Is (POINT[0], POINT[1]) a solution of the inequality?

[ graph.pointA.coord, graph.pointB.coord, graph.pointA.coord[0] > graph.pointB.coord[0] ? graph.shadetop : !graph.shadetop, graph.dasharray === "- " ? false : true, $("input[name='isSolution']:checked").attr("id")]
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 ) < 0.001 && abs( YINT - yint ) < 0.001 && guess[2] === LESS_THAN && guess[3] === INCLUSIVE && POINT_SOLUTION === (guess[4] === 'yes');
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();

Let's first convert the inequality into slope-intercept form, which allows us to determine the y-intercept and the slope of the line in order to graph it.

\qquad\begin{eqnarray} expr(["+", ["*", A, "x"], ["*", B, "y"]]) &STD_FORM_COMP& C \\ coefficient(B)y &STD_FORM_COMP& expr([ "+", [ "*", -A, "x" ], C ]) \\ y &COMP& PRETTY_SLOPE + YINT \end{eqnarray}

Since the inequality is in slope-intercept form, we can use the y-intercept and the slope of the line in order to graph it.

The inequality sign then tells us which side of the line is to be shaded and whether the line is solid or dashed.

Finally, we can see whether or not our given point lies in the shaded area to check if it's a solution of the inequality.

Based on the inequality, we can see that the y-intercept of the boundary line is the point (0, YINT). We can also see that the slope of the line is fractionReduce(SLOPE_FRAC[0], SLOPE_FRAC[1]).

This means that for every \blue{SLOPE_FRAC[1]} plural_form(genericUnit[1], SLOPE_FRAC[1]) we increase along the x-axis, we move \pink{abs(SLOPE_FRAC[0])} plural_form(genericUnit[1], SLOPE_FRAC[0]) down the y-axis to find another point on the boundary line:

This means that for every \blue{SLOPE_FRAC[1]} plural_form(genericUnit[1], SLOPE_FRAC[1]) we increase along the x-axis, we move \pink{abs(SLOPE_FRAC[0])} plural_form(genericUnit[1], SLOPE_FRAC[0]) up the y-axis to find another point on the boundary line:

(0 + \blue{SLOPE_FRAC[1]}, YINT + \pink{SLOPE_FRAC[0]}) = (SLOPE_FRAC[1], YINT + SLOPE_FRAC[0])

We can now connect these points to graph the line.

graph.pointA.setCoord([0, YINT]); graph.pointB.setCoord([SLOPE_FRAC[1], YINT + SLOPE_FRAC[0]]); graph.update();

The inequality is y COMP PRETTY_SLOPE + YINT.

This means that for each point (x, y) in the solution set, the y-value is less than or equal PRETTY_SLOPE + YINT. Therefore, the solution set lies below the line and the line should be solid.
This means that for each point (x, y) in the solution set, the y-value is strictly less than PRETTY_SLOPE + YINT. Therefore, the solution set lies below the line and the line should be dashed.
This means that for each point (x, y) in the solution set, the y-value is greater than or equal PRETTY_SLOPE + YINT. Therefore, the solution set lies above the line and the line should be solid.
This means that for each point (x, y) in the solution set, the y-value is strictly greater than PRETTY_SLOPE + YINT. Therefore, the solution set lies above the line and the line should be dashed.
graph.shadetop = graph.pointA.coord[0] > graph.pointB.coord[0] ? LESS_THAN : !LESS_THAN; if (INCLUSIVE) { graph.dasharray = ''; $('input[name=dashradio][value=solid]').attr('checked', true); } else { graph.dasharray = '- '; $('input[name=dashradio][value=dashed]').attr('checked', true); } graph.update();

We can see that (POINT[0], POINT[1]) lies within the shaded area, which means that it is a solution of the inequality.

We can see that (POINT[0], POINT[1]) lies outline of the shaded area, which means that it is not a solution of the inequality.

style({ stroke: PINK, fill: PINK }, function() { circle( [ POINT[0], POINT[1] ], 0.2 ).toBack(); });