Simplex Method Calculator
Maximise or minimise a two-variable linear objective subject to inequality constraints, returning the optimal values of x1 and x2.
Simplex Method Calculator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser — no data is sent to any server.
Formula: Maximize/Minimize Z = c₁x₁ + c₂x₂ subject to constraints
Worked example — Optimal Z = 21 at x1 = 3, x2 = 1.5 | Both constraints binding (s1 = s2 = 0)
Formula
Maximize/Minimize Z = c₁x₁ + c₂x₂ subject to constraints
Linear programming optimization using objective function and inequality constraints.
Worked Examples
Example 1: Classic two-constraint maximisation
Problem:Maximise Z = 5x1 + 4x2 subject to 6x1 + 4x2 <= 24 and x1 + 2x2 <= 6, with x1 >= 0 and x2 >= 0.
Solution:Add slack variables s1 and s2 so the constraints become equations: 6x1 + 4x2 + s1 = 24 and x1 + 2x2 + s2 = 6. The starting basis is s1 = 24, s2 = 6, Z = 0. Iteration 1: x1 has the largest objective coefficient (5), so it enters. Minimum-ratio test: 24/6 = 4 and 6/1 = 6, so the smaller ratio picks row 1 and s1 leaves. New vertex (4, 0) with Z = 20. Iteration 2: x2 now still improves Z, so it enters and s2 leaves. Solving the two binding equations 6x1 + 4x2 = 24 and x1 + 2x2 = 6 gives 4x1 = 12, so x1 = 3 and x2 = 1.5. Z = 5(3) + 4(1.5) = 15 + 6 = 21. No positive reduced costs remain, so this is optimal. Corner check: (0,0) gives 0, (4,0) gives 20, (0,3) gives 12, (3,1.5) gives 21.
Result:Optimal Z = 21 at x1 = 3, x2 = 1.5 | Both constraints binding (s1 = s2 = 0)
Example 2: Reading slack from a non-binding constraint
Problem:Maximise Z = 2x1 + 3x2 subject to x1 + x2 <= 10 and 2x1 + x2 <= 16, with x1 >= 0 and x2 >= 0.
Solution:Corners of the feasible region: (0, 0): Z = 0 (8, 0) from 2x1 = 16: check x1 + x2 = 8 <= 10, feasible. Z = 16 (0, 10) from x1 + x2 = 10: check 2(0) + 10 = 10 <= 16, feasible. Z = 30 Intersection of x1 + x2 = 10 and 2x1 + x2 = 16: subtracting gives x1 = 6, so x2 = 4 and Z = 12 + 12 = 24 The best corner is (0, 10) with Z = 30. Slack at the optimum: constraint 1 gives 0 + 10 = 10, so s1 = 0 and it is binding; constraint 2 gives 0 + 10 = 10, so s2 = 16 - 10 = 6 of unused capacity.
Result:Optimal Z = 30 at x1 = 0, x2 = 10 | x1 + x2 <= 10 is binding | 6 units of slack on 2x1 + x2 <= 16
Frequently Asked Questions
What is the simplex method and how does it work?
The simplex method is an iterative algorithm for solving linear programming problems. It starts at a basic feasible solution (a corner vertex of the feasible region), then systematically pivots to adjacent vertices that improve the objective function value, continuing until no improving vertex exists or the problem is found to be unbounded.
How do you identify the optimal solution in a simplex tableau?
In a maximization problem, the current solution is optimal when all reduced costs in the objective row of the simplex tableau are non-positive (no positive entries remain for non-basic variables). The optimal objective value Z is read from the tableau's right-hand side, and the optimal variable values are read from the basic variable column positions.
What is the difference between the simplex method and graphical LP?
The graphical method is limited to two decision variables and solves the problem by plotting constraints and identifying the optimal corner point visually. The simplex method works algebraically using tableau operations and can handle any number of variables and constraints, making it the practical choice for real-world problems with many dimensions.
What are the assumptions and limitations of the simplex method?
The simplex method assumes a linear objective function and linear constraints, non-negative decision variables (x ≥ 0), and that a bounded feasible region exists. It assumes divisibility — variables can be fractional. Limitations include cycling (rare but possible without anti-cycling rules), and it cannot directly handle integer requirements (which require branch-and-bound or cutting-plane methods instead).
What are slack, surplus and artificial variables?
A less-than-or-equal constraint becomes an equation by adding a non-negative slack variable that absorbs unused capacity. A greater-than-or-equal constraint has a surplus variable subtracted instead, which leaves no obvious starting basis, so an artificial variable is added and then driven out using the Big-M penalty or a two-phase method. Slack values at the optimum tell you directly how much of each resource went unused.
How do I handle a minimisation objective with this method?
Minimising Z is identical to maximising −Z, so flip the sign of every objective coefficient, solve the maximisation, then negate the reported optimum to recover the minimum. The optimal decision variables are unchanged by this switch. Since Simplex Method Calculator maximises, a cost function of 3x₁ + 5x₂ is entered as coefficients −3 and −5, and the minimum cost is the negative of the Z shown. Note that with only less-than-or-equal constraints and x ≥ 0, a pure cost minimisation is driven to the origin, so a realistic model needs greater-than-or-equal demand constraints as well.
What does the shadow price of a constraint tell me?
It is the rate at which the optimal objective value would improve if that constraint had one more unit on its right-hand side, in other words the marginal worth of one extra hour, kilogram or machine slot. Only binding constraints carry a non-zero shadow price, because a constraint with slack left over is worth nothing extra. The rate holds only over a range, after which the optimal basis changes.
How do I tell which constraints are binding at the optimum?
Substitute the optimal point back into each constraint. If the left side equals the right-hand side the constraint is binding and its slack is zero; if there is room to spare it is non-binding. In the worked example, x₁ = 3 and x₂ = 1.5 gives 6(3) + 4(1.5) = 24 and 3 + 2(1.5) = 6, so both constraints are tight and the optimum sits at their intersection.
What is degeneracy in a simplex tableau and why does it matter?
A basic solution is degenerate when a basic variable sits at zero, which typically follows a tie in the minimum-ratio test. The next pivot then changes the basis while improving the objective by nothing, and in rare constructed cases the algorithm can cycle among the same bases indefinitely. Anti-cycling rules such as Bland's rule, which always picks the lowest-indexed eligible variable, guarantee termination.
How are the pivot column and pivot row chosen at each iteration?
The entering variable is the non-basic variable whose reduced cost promises the largest gain, which for a maximisation in standard tableau form is the most positive coefficient in the objective row. The leaving variable comes from the minimum-ratio test: divide each right-hand side by the corresponding positive entry of the pivot column and take the smallest ratio. If no entry is positive, the problem is unbounded.
References
Reviewed for accuracy by Manoj Kumar, Mathematics Educator · Editorial policy
Related Calculators
🧮Box Method Calculator
Calculate box method with inputs, formulas, and instant results.
🧮Elimination Method Calculator
Calculate elimination method with inputs, formulas, and instant results.
🧮Substitution Method Calculator
Calculate substitution method with inputs, formulas, and instant results.
🧮Least Common Multiple Calculator
Find the LCM of two or more numbers using prime factorization and the GCF method.
🧮Annulus Area Calculator
Calculate annulus area with inputs, formulas, and instant results.
🧮Area Calculator
Calculate area with inputs, formulas, and instant results.
🧮Area of a Rectangle Calculator
Calculate the area, perimeter, and diagonal of a rectangle. Find missing sides from known area. Convert between metric and imperial area units.