Navigation:  How do I ...? > Algebra >

How do I graph an inequality?

Print this Topic Previous pageReturn to chapter overviewNext page
Show/Hide Hidden Items

Rather than a line or a curve, the solution set for an inequality involving X and Y fills an area on the XY plane. An equation defines the boundary or edge of the set. Although DPlot will not directly solve for and plot inequalities, you can easily do so yourself in a few steps. First rearrange the inequality (if necessary) in the form Y < (or <, >, >) f(X). Use the Y=f(X) command on the Generate menu to plot the boundary of the inequality. If the inequality is < or > rather than < or >, the usual practice is to plot this boundary using a dashed line. To change the line type of the boundary line or curve, right click anywhere on the boundary and select "Line style". Finally, use the Fill Between Curves command on the Options menu to fill in the area above or below the boundary, depending on whether the inequality is > (above the boundary) or < (below the boundary).

Example: Graph the solution to y 2x-3.

1. Select Y=f(X) on the Generate menu. In the "Y=" box type 2*x-3. (Note the multiplication sign; you must include all operators in your equation; in this case DPlot would not recognize 2x as 2*x. Enter a start and end value for X. In this example we've used -10 < X < 10 with an interval of 1. (The interval is not important since we are only graphing a line; two points are sufficient.) That operation produces a graph similar to:

2. The Y=f(X) command will automatically produce a legend as shown in the graph above. If you do not want this legend, right click anywhere on the legend and select "Hide Legend".

3. If you would like the physical distance between X and Y units to be the same, select the Extents/Intervals/Size command on the Options menu, check "Specify extents" and enter the extents you want, then check "Specify size" and enter width and height values that have the same proportions as the graph extents. In this example extents of +10 for both X and Y and width=height works well.

4. You can change the appearance of the coordinate axes by clicking any of the Grid/Box buttons on the toolbar or selecting the Grid Lines or Box command on the Options menu. And if you want the coordinate axes to pass through X=0 and Y=0 rather than being placed on the left and bottom sides of the graph, check the Axes at 0 option under Grid Lines or Box. The above changes result in:

5. Select Fill Between Curves on the Options menu. Although this command is primarily used to fill in areas between two different curves, it can also be used to fill the region between a curve or line and some X or Y reference line. In the "1st Curve" list select "2*x-3". For the "2nd Curve" entry, since our inequality is < we are interested in Y values less than the line we just graphed. So we select "Bottom" from the list. This will result in the area between the lower X axis and the line y=2*x-3 being filled. Select the fill style and color you want to use, then click OK.

6. Finally, you'll want to add a label to the graph describing the inequality. You could place the label in the graph title (Title/Axes command on the Text menu). In this example we'll add the label using a notation. Select Add/Edit Note on the Text menu, or click the Note button on the toolbar. Click the "Add note" button. In the "Note" box, type "y < 2x-3" then select the < character and click the underline button. Check the "Frame note" and "Opaque" boxes, then click OK. You can drag the note to the desired location with your mouse. The finished product:

Example: Graph the solution to 2x - 3y < 6.

1. This example requires an extra step since we first need the equation expressed as y as some function of x. First solve for y:

2x - 3y < 6

-3y < -2x + 6

y > 2x/3 - 2

Note the flipped inequality in the last step: don't forget to flip the inequality if you change signs (multiply or divide by a negative number).

2. Proceed as in the previous example with the Y=f(X) command, this time with Y=2*X/3-2:

3. Note that in this example the expression is "y greater than", not "y greater than or equal to" For strict inequalities the usual practice is to show the boundary as a dashed line rather than a solid line. To change line styles right click anywhere on the line and select "Line style". After this and other formatting changes similar to the first example, your graph will resemble this:

4. Once again, use the Fill Between Curves command on the Options menu to fill the region above the curve (above because Y > f(X)).

We have used linear functions in these examples for simplicity. But there is nothing restricting you from using more complex functions (polynomials, trigonometric functions, etc.) for this technique. One important difference with non-linear inequalities is that when using the Y=f(X) command, the interval between X values now is important in order to get sufficient detail. In general you'll want to use an interval of the X extents divided by 1000, or smaller. For high-order polynomials a smaller interval may be needed.

If you would like to graph the solution to a set of two or more inequalities at once, see the How do I graph the solution to a system of inequalities? topic.

 


Page url: https://www.dplot.com/help/index.htm?how_inequality.htm