Objective
Use x and y as decision variables.
Constraints
Drag a boundary line on the graph to adjust its right-hand side.
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.
Use x and y as decision variables.
Drag a boundary line on the graph to adjust its right-hand side.
▼ See explanations and tips below ▼
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:
For a two-variable model, the objective often has the form:
The constraints often have forms such as:
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.
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.
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:
For the objective:
where:
A typical constraint is:
where:
For a \(\le\) resource limit, slack can be written as:
For a \(\ge\) minimum requirement, the similar idea is surplus:
A slack or surplus value of zero means the constraint is binding at that point.
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:
The constraints are:
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:
At this point, the first two constraints are binding, while the constraint \(x \le 40\) has slack.
Now suppose the objective is to minimize:
with constraints:
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:
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:
subject only to:
There is no upper limit on \(x\) or \(y\). Moving farther into the first quadrant keeps increasing \(z\), so there is no finite maximum.
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.
Use a two-variable linear programming model when:
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.
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.
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.
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.
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.
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.
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.
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.
Books and Open Textbooks