MathsGraphing & Visualization

Inequality
grapher.

Graph up to four inequalities in x and y and see the region where all of them hold.

How it's worked out

An inequality in two variables splits the plane into two parts. The edge between them, the boundary, is what you get when you swap the sign for an equals sign. OpenStax gives the hand method in three steps: draw the boundary, test a point that is not on it, and shade the side where the test comes out true.

The boundary is solid for ≤ and ≥, because points on it count. It is dashed for < and >, because they do not. The tool moves every term to one side and checks the sign of what is left:

g(x,y)\displaystyle g(x, y)=left side−right side\displaystyle {}=\;\text{left side} - \text{right side}

For y>2x−3y > 2x - 3, that gives g=y−2x+3g = y - 2x + 3, and a point is a solution when g is above 0. The tool works out g across a fine grid, shades every cell that passes, and traces the line where g is exactly 0. That works for curves too, such as a circle, where y is not a single function of x.

A system is several inequalities at once. Its solution is the overlap, the part shaded by all of them, which OpenStax calls the region shaded twice when there are two. For x≥0x \ge 0, y≥0y \ge 0 and 2x+3y≤122x + 3y \le 12, the overlap is a triangle with an area of 12.

Corner points are where two straight boundaries meet on the edge of the region. Each straight boundary is ax+by+c=0a x + b y + c = 0, and two of them cross at:

x\displaystyle x=b1c2−b2c1a1b2−a2b1\displaystyle {}= \frac{b_1 c_2 - b_2 c_1}{a_1 b_2 - a_2 b_1}
y\displaystyle y=a2c1−a1c2a1b2−a2b1\displaystyle {}= \frac{a_2 c_1 - a_1 c_2}{a_1 b_2 - a_2 b_1}

If the bottom is 0, the lines are parallel and never meet. Not every crossing is a corner: one that lands outside the region is dropped. When the corners close the region in, its area comes from the shoelace formula, with the corners in order around the shape:

A\displaystyle A=12|∑i(xiyi+1−xi+1yi)|\displaystyle {}= \frac{1}{2}\left|\sum_{i} \left(x_i y_{i+1} - x_{i+1} y_i\right)\right|

Worked examples

Priya checks a two-line homework system

Priya has to graph y>2x−3y > 2x - 3 and y≤−x+4y \le -x + 4 and show that the origin is a solution. The first boundary is dashed and the second is solid.

At (0, 0) the first one leaves 3 after moving everything left, and 3 is above 0. The second leaves −4, which is at most 0. Both hold, so the origin is a solution, and the shading covers it.

The two lines cross at (73\frac{7}{3}, 53\frac{5}{3}). That corner sits on the dashed line, so it is drawn as an open dot and is not a solution itself. The region is open on the left, so it runs past the edge of the graph and has no finite area. About 45% of the window from −10 to 10 is shaded.

Open this example in the tool

Theo plans the bars for a soap stall

Theo makes small bars (x) and large bars (y) for a craft fair. He wants at least 20 bars, so x+y≥20x + y \ge 20. A small bar takes 3 oz of soap base, a large one takes 6 oz, and he has 90 oz, so 3x+6y≤903x + 6y \le 90. He cannot make a negative number of either.

The four boundaries close in a triangle with corners at (10, 10), (20, 0), (30, 0). Its area is 50 square units. A plan of 20 small and 4 large bars is inside it. A plan of 5 small and 10 large bars fails 1 of the four, because 15 bars is short of his minimum.

If he later adds a price for each bar, the plan that earns the most will be at one of those three corners, which is why the corner list matters in linear programming.

Open this example in the tool

Ana marks a garden bed and a path

Ana sketches a round bed of radius 4 m centered on a post, x2+y2≤16x^2 + y^2 \le 16, and a straight path along y=x−2y = x - 2. She wants the part of the bed on the post side of the path, y>x−2y > x - 2.

The circle is solid and the path is dashed. A plant at (−2, 1) is in the region. One at (3, 0) is inside the circle (true) but on the wrong side of the path (false), so it is out.

About 36% of the window from −5 to 5 is shaded. Because one edge is curved, the tool lists no corners and gives no exact area. The shaded share of the window is the estimate to use.

Open this example in the tool

Reading your result

The answer says whether your test point satisfies every inequality. The working shows each one with the point put in, the left side minus the right side, and that number compared with 0. If one is false, the point is outside, and the answer names the inequality it breaks.

Filled and open dots. A corner on a solid edge is a solution and is filled. A corner where a dashed edge passes is not a solution, so it is open, even though the region comes right up to it.

Unbounded regions. If you can walk off in some direction and stay inside, the region has no finite area. Two lines that cross in an X leave such a region. The tool checks this from the boundary lines themselves, not from the window, so zooming out does not change it.

No shading at all means the inequalities share no point in the window. OpenStax gives 4x+3y≥124x + 3y \ge 12 with y<−43x+1y < -\frac{4}{3}x + 1 as an example: the lines are parallel and the sides point away from each other, and 0% of the window is shaded. Try a larger window before you decide a system has no solution.

Common mistakes

  • Forgetting to flip the sign. Dividing −y≥x-y \ge x by −1 gives y≤−xy \le -x, not y≥−xy \ge -x. At (1, 0), the version as typed is false, the correct rewrite is false, and the wrong one is true. Type it either way and compare the shading.
  • Testing a point on the line. For y≤−4xy \le -4x the boundary passes through the origin, so (0, 0) tells you nothing. OpenStax tests (1, 0) instead, and it fails, so you shade the other side.
  • Reading "greater than" as "above" every time. That only works when y is alone on the left with a plus sign. In 2x+3y<62x + 3y < 6 the region is below the line, and in −y>x-y > x it is below too.
  • Writing a chain on one line. Split 1<x<31 < x < 3 into x>1x > 1 and x<3x < 3. The tool asks for one sign per line.
  • Drawing a dashed line as solid. It changes the answer for points on the edge, such as a corner that a linear programming answer might use.

Questions people ask

No. A dashed line means the sign is strict, so a point on the line makes both sides equal and the inequality false. A point on a solid line is a solution, because equal is allowed.

Sources