b2KIT

Linear Programming Solver

Solve 2-variable LP problems graphically. Define constraints, plot feasible region, and find optimal vertex with objective function slider.

Tested tool guide Tested browser tools Checked August 16, 2026

What Linear Programming Solver does, with a checked example

This solver turns a two-variable linear program into a plane geometry problem. Enter a linear objective in x and y, choose maximization or minimization, and add linear inequality constraints. It plots the constraint boundaries, shows their common feasible region, and identifies the vertex that optimizes the objective. The objective slider relates objective levels to the graph. A frequent surprise is that the best solution may not be unique: if the objective is parallel to a feasible edge, every point along that edge can share the optimal value.

Worked example

A concrete input and expected output from the current implementation.

Input

Maximize: 3x + 2y
Constraints:
x + y <= 4
x <= 2
x >= 0
y >= 0

Expected output

Optimal vertex: (2, 2)
Maximum objective value: 10

The feasible vertices are (0, 0), (2, 0), (2, 2), and (0, 4). Their objective values are 0, 6, 10, and 8, respectively, so (2, 2) gives the maximum.

How the result is produced

1

Building the feasible region

Each constraint places a boundary line on the x-y plane and permits the points on one specified side. The overlap of all permitted half-planes is the feasible region. Its vertices occur where constraint boundaries intersect. Reversing a relation such as <= to >= selects the opposite side of its line and can completely change that region.

2

Optimizing over vertices

A linear objective has parallel level lines whose values increase in one direction. For a bounded feasible polygon, a maximum or minimum is attained at a vertex, although an entire edge can tie. The solver identifies the best feasible vertex, while the objective slider provides a graphical view of how objective levels meet the feasible region.

Good uses

  • Find the best mix of two products subject to labor, material, or capacity inequalities.
  • Check a hand-drawn feasible region and optimal corner for a two-variable linear programming exercise.
  • See how a proposed linear cost, profit, or scoring objective interacts with several plotted constraints.

Limits and checks

  • The graph represents exactly two decision variables. A model with three or more independent variables cannot be displayed faithfully on this plane.
  • Check whether x >= 0 and y >= 0 are included when required. Without them, points with negative coordinates may remain feasible.
  • A reported optimal vertex does not necessarily imply a unique solution. An adjacent vertex with the same objective value indicates an optimal edge.

Common questions

Why does the solver look for an optimum at a vertex?

Over a bounded polygonal feasible region, a linear objective changes at a constant rate in a fixed direction, and at least one vertex attains its maximum or minimum. The optimum can also extend across an edge when the objective is parallel to that edge, so the vertex is then one representative optimal solution rather than the only one.

Can this solve a linear program with three or more variables?

No, not as a full graphical model. Its coordinate plane and feasible-region plot are limited to x and y. A larger problem must first be reduced to two variables, if that reduction is mathematically valid, or handled by a general linear programming solver. Simply omitting additional variables changes the model.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools