Linear Programming Solver (Graphical Method)

Use this Linear Programming Solver (Graphical Method) to enter values, adjust options, and review results in a compact responsive workspace.

Results are calculated automatically as you enter data.

Objective

Use x and y as decision variables.

Constraints

Drag a boundary line on the graph to adjust its right-hand side.

Optimal solution -
Corner-point method and sensitivity notes

▼ See explanations and tips below ▼

What Is Linear Programming?

Linear programming is a method for choosing the best values of decision variables when the goal and the restrictions can all be written with linear expressions. In a two-variable problem, the variables are usually called \(x\) and \(y\). The goal is to make an objective value as large as possible or as small as possible while still satisfying every constraint.

A simple linear programming model has three parts:

  • Decision variables: the quantities being chosen, such as the number of two products to make.
  • Objective function: the value to maximize or minimize, such as profit, cost, time, or distance.
  • Constraints: limits or requirements written as linear inequalities or equations.

For a two-variable model, the objective often has the form:

$$ z = c_x x + c_y y $$

The constraints often have forms such as:

$$ a x + b y \le \text{rhs} $$
$$ a x + b y \ge \text{rhs} $$
$$ a x + b y = \text{rhs} $$

The calculator solves continuous two-variable linear programming problems exactly from decimal inputs. It checks corner points, feasible boundary representatives, and recession directions, so it can also classify half-planes, strips, lines, infeasible models, and unbounded objectives.


Why Linear Programming Matters

Linear programming is useful because many real decisions involve limited resources. A business may want to maximize profit with limited labor and materials. A shipper may want to minimize cost while meeting delivery requirements. A student may use it to understand how systems of inequalities connect to optimization.

The value of linear programming is not only the final number. It also helps you see which restrictions matter most. A constraint that is tight at the solution may be the reason you cannot improve the objective further. A constraint with slack may not affect the best answer for the current model.


Key Terms to Know

  • Decision variable: A quantity you are trying to choose. In this calculator, the variables are \(x\) and \(y\).
  • Objective function: The expression being maximized or minimized, such as \(z = 40x + 30y\).
  • Constraint: A limit or requirement, such as \(2x + y \le 100\).
  • Feasible point: A point \((x, y)\) that satisfies every constraint.
  • Feasible region: The set of all feasible points.
  • Boundary line: The line created by replacing an inequality with an equality. For example, \(2x + y \le 100\) has boundary line \(2x + y = 100\).
  • Corner point: A vertex of the feasible region, usually where two boundary lines meet.
  • Binding constraint: A constraint that is exactly tight at the solution.
  • Slack: Unused room in a \(\le\) constraint. For example, if a resource limit is not fully used, it has slack.
  • Unbounded objective: A case where the objective can keep improving without a finite best value.
  • Infeasible model: A case where no point satisfies all constraints at the same time.

How the Graphical Corner-Point Method Works

The graphical method works because a two-variable linear inequality divides the coordinate plane into a half-plane. An equality constraint instead limits the feasible points to its boundary line. When all constraints are graphed together, their overlap is the feasible region. If a finite optimum exists for a bounded polygonal feasible region, it can be found at a corner point.

The basic process is:

  1. Write the objective function.
  2. Write each restriction as a linear constraint.
  3. Graph the boundary lines for the constraints.
  4. Identify the region where all constraints are true.
  5. Find the feasible corner points.
  6. Evaluate the objective function at each feasible corner point.
  7. Choose the largest value for a maximization problem or the smallest value for a minimization problem.

For the objective:

$$ z = c_x x + c_y y $$

where:

  • \(x\) = first decision variable
  • \(y\) = second decision variable
  • \(c_x\) = objective coefficient for \(x\)
  • \(c_y\) = objective coefficient for \(y\)
  • \(z\) = objective value

A typical constraint is:

$$ a x + b y \le \text{rhs} $$

where:

  • \(a\) = coefficient of \(x\)
  • \(b\) = coefficient of \(y\)
  • \(\text{rhs}\) = right-hand side of the constraint

For a \(\le\) resource limit, slack can be written as:

$$ \text{slack} = \text{rhs} - (a x + b y) $$

For a \(\ge\) minimum requirement, the similar idea is surplus:

$$ \text{surplus} = (a x + b y) - \text{rhs} $$

A slack or surplus value of zero means the constraint is binding at that point.


Examples of Linear Programming in Practice

Example 1: Maximizing a Two-Product Objective

Suppose a small workshop makes two products. Let \(x\) be the number of units of the first product and \(y\) be the number of units of the second product. The objective is:

$$ \text{Maximize } z = 40x + 30y $$

The constraints are:

$$ \begin{aligned} 2x + y &\le 100 \\ x + y &\le 80 \\ x &\le 40 \\ x &\ge 0 \\ y &\ge 0 \end{aligned} $$

The feasible corner points are:

Corner point Objective value \(z = 40x + 30y\)
\((0, 0)\) \(0\)
\((40, 0)\) \(1600\)
\((40, 20)\) \(2200\)
\((20, 60)\) \(2600\)
\((0, 80)\) \(2400\)

The largest objective value is \(2600\), so the best corner point is:

$$ (x, y) = (20, 60) $$

At this point, the first two constraints are binding, while the constraint \(x \le 40\) has slack.


Example 2: Minimizing a Requirement-Based Model

Now suppose the objective is to minimize:

$$ \text{Minimize } z = 6x + 8y $$

with constraints:

$$ \begin{aligned} x + y &\ge 12 \\ 2x + y &\ge 16 \\ x + 3y &\ge 18 \\ x &\ge 0 \\ y &\ge 0 \end{aligned} $$

This kind of model describes a situation where minimum requirements must be met. Because the inequalities use \(\ge\), the feasible region lies on the side of each line that satisfies the minimum.

Some feasible corner points and objective values are:

Corner point Objective value \(z = 6x + 8y\)
\((0, 16)\) \(128\)
\((4, 8)\) \(88\)
\((9, 3)\) \(78\)
\((18, 0)\) \(108\)

The smallest listed value is \(78\), so the minimizing corner point is:

$$ (x, y) = (9, 3) $$

Example 3: An Unbounded Objective

An unbounded feasible region does not automatically mean the model has no useful answer. The important question is whether the objective can keep improving forever inside the feasible region.

For example:

$$ \text{Maximize } z = x + y $$

subject only to:

$$ \begin{aligned} x &\ge 0 \\ y &\ge 0 \end{aligned} $$

There is no upper limit on \(x\) or \(y\). Moving farther into the first quadrant keeps increasing \(z\), so there is no finite maximum.


How to Interpret the Result

A finite result such as “Max \(z\) at \((x, y)\)” or “Min \(z\) at \((x, y)\)” usually comes from comparing feasible corner points in a nondegenerate polygonal region. Equality-only models can instead have a finite value along a line or ray; in that case the calculator reports a representative point and describes the full optimal set.

When the model has vertices, the corner-point table shows the candidates that were compared, and its optimal row is the selected best finite vertex. A finite equality-only model can have no vertices, so its table can be empty.

A binding constraint has zero or nearly zero slack at the optimum. This means the optimal point lies on that constraint’s boundary line. A positive slack value usually means the restriction is not fully used at the selected solution.

If the result says the model is infeasible, the constraints conflict with one another and no point satisfies them all. If the result says the objective is unbounded, the model may still be mathematically valid, but it does not have a finite best value in the chosen direction. For a finite equality-only model with no vertices, use the representative point and optimal-set description rather than expecting a table row.

The graph is a visual aid. The reported numbers come from the model’s equations, candidate intersections, feasibility checks, and objective-value comparisons.


Common Mistakes and Misconceptions

  • Forgetting nonnegativity: If \(x\) and \(y\) represent quantities such as units, boxes, hours, or servings, negative values usually do not make sense. Include \(x \ge 0\) and \(y \ge 0\) when needed.
  • Using the wrong inequality direction: Resource limits usually use \(\le\), while minimum requirements usually use \(\ge\).
  • Putting objective coefficients in the constraint rows: The objective describes what you want to optimize. Constraints describe what limits or requirements must be satisfied.
  • Using a zero objective direction: If both objective coefficients are zero, every feasible point has objective value \(0\), so the entire feasible region is optimal.
  • Using a constant constraint: A row with two zero coefficients is either always true and redundant, or always false and makes the model infeasible.
  • Expecting integer answers: A graphical linear programming solution may include decimals. If variables must be whole numbers, the problem is an integer programming problem, not a standard two-variable linear programming problem.
  • Assuming every unbounded region is a problem: A region may be unbounded while still having a finite optimum for some objective directions.
  • Reading too much into the graph window: A clipped or zoomed graph may hide distant parts of the feasible region, but the calculation is based on numeric intersections and feasibility tests.
  • Overlooking alternate optima: In some models, a complete segment, ray, line, or feasible region gives the same best objective value. The optimal-solutions result describes that full set.

When to Use Linear Programming

Use a two-variable linear programming model when:

  • You have two decision variables.
  • The objective can be written as a linear expression.
  • Every restriction can be written as a linear inequality or equation.
  • You need to maximize or minimize a quantity.
  • A graph of the feasible region would help explain the decision.
  • You want to compare candidate corner points rather than solve a larger optimization model.

Common classroom and practical examples include production planning, diet or blend problems, shipping models, budget allocation, scheduling with two activity types, and resource-limited profit or cost problems.


Limitations and Things to Keep in Mind

The graphical corner-point method is designed for two-variable linear models. It is not intended for problems with three or more variables, nonlinear formulas, strict inequalities, random inputs, multiple objectives, or integer-only decisions.

The calculator accepts decimal and negative numeric coefficients, but the meaning of those values depends on the model. A negative coefficient may make sense in some algebraic models and not in others. The variables and coefficients do not have fixed units, so you must decide what \(x\), \(y\), the right-hand sides, and the objective value represent.

Equality constraints are more restrictive than inequalities because they keep only points that lie exactly on a line. A model with several equality constraints can easily become infeasible or produce a feasible set with no useful corner-point comparison.

Decimal and scientific-notation inputs are converted to exact rational values before feasibility and optimization checks. Fractional results are shown exactly with a decimal approximation when useful. The graph converts those exact results to screen coordinates, so graph clipping and visual rounding do not affect the reported answer. Inputs support up to 30 significant digits, exponents from \(-300\) to \(300\), and 100 user constraints.

This type of calculator does not replace professional judgment. When an optimization result affects money, safety, engineering work, legal obligations, official records, or health-related decisions, verify the model carefully and consult a qualified professional when appropriate.


How to Use This Calculator

  1. Choose whether the objective should be maximized or minimized.
  2. Enter the objective coefficients for \(x\) and \(y\).
  3. Turn on nonnegative variables if the model should include \(x \ge 0\) and \(y \ge 0\).
  4. Enter each constraint using an \(x\) coefficient, a \(y\) coefficient, an operator, and a right-hand side.
  5. Add or remove constraint rows as needed.
  6. Review the result headline to see whether the model has a finite optimum, is infeasible, or is unbounded. For an equality-only finite model, also read the optimal-set description.
  7. Compare the corner-point table when the model has feasible vertices and objective values.
  8. Use the graph to visualize the constraints, feasible region, vertices, and selected optimum.
  9. Download the graph if you need a saved visual of the model.

Frequently Asked Questions

What is the difference between maximizing and minimizing?

Maximizing means choosing \(x\) and \(y\) to make the objective value as large as possible. Minimizing means choosing them to make the objective value as small as possible. The constraints stay the same; only the direction of the objective comparison changes.


Why does the graphical method check corner points?

In a two-variable linear programming problem, the feasible region is built from straight-line boundaries. For a bounded feasible region with a finite optimum, the best value of a linear objective occurs at a corner point, so checking the corners is enough to find the optimum.


What does it mean if a constraint is binding?

A binding constraint is exactly tight at the solution. The optimal point lies on that constraint’s boundary line, and its slack is zero or close to zero. Binding constraints are often important because they limit further improvement of the objective.


What does an infeasible result mean?

An infeasible result means the constraints cannot all be true at the same time. For example, one constraint might require a value to be at least \(10\), while another requires the same expression to be no more than \(5\). In that case, no point can satisfy the full model.


What does an unbounded result mean?

An unbounded result means the feasible region contains a direction where the objective can keep improving without limit. It does not necessarily mean the inputs are typed incorrectly. It often means the model is missing a realistic upper or lower restriction.


Can this method solve problems with more than two variables?

The graphical corner-point method used here is for two-variable models. Problems with more than two variables usually need algebraic optimization methods such as the simplex method, matrix-based approaches, or specialized optimization software.


Sources and References

Books and Open Textbooks

  1. OpenStax. Contemporary Mathematics. OpenStax, 2023. Section 5.11, “Linear Programming.” https://openstax.org/books/contemporary-mathematics/pages/5-11-linear-programming
  2. OpenStax. Intermediate Algebra 2e. OpenStax, 2020. Section 4.7, “Graphing Systems of Linear Inequalities.” https://openstax.org/books/intermediate-algebra-2e/pages/4-7-graphing-systems-of-linear-inequalities
  3. LOUIS: The Louisiana Library Network. Finite Mathematics. Pressbooks, 2024. Chapter 3.3, “Linear Programming.” https://louis.pressbooks.pub/finitemathematics/chapter/3-3-linear-programming/