Linear Programming Calculator with Steps (up to 21 variables)
Linear Programming Calculator
Solve LP/ILP models with a clear coefficient table. Assumes xᵢ ≥ 0 for all variables; optional upper bounds xᵢ ≤ Uᵢ are supported.
Inputs
Fractions allowed (e.g., 5/3). Decimal mode is faster but approximate.
Beginner mode adds plain‑English narration plus a feasibility verification table (constraint-by-constraint).
Objective coefficients (c)
Upper bounds (optional)
Enter Uᵢ to enforce xᵢ ≤ Uᵢ. Leave blank for “no upper bound”. Nonnegativity xᵢ ≥ 0 is always assumed.
Advanced (integer/binary + step detail + bulk paste)
If you pick integer/binary, the solver switches to Branch & Bound automatically.
Bulk paste (optional)
UB line is optional. Leave a blank entry for “no upper bound”.
Constraints (A x ≤/≥/= b)
Fill coefficients, choose relation, then RHS.
Results
—
Step-by-step explanation
Steps will appear here after you calculate.
Primal ↔ Dual (optional: generate & solve)
Run a calculation first.
Export full report
Export a complete worked solution (copy/paste friendly).
Choose Word-friendly text to paste into Word. Use HTML for rich formatting.
Chart
If N=2: boundary lines are drawn (no feasible shading). If N>2: a bar chart of top variables is shown after you solve.
Understanding the results
- Status explains whether the model is feasible and bounded (Optimal / Multiple optimal / Infeasible / Unbounded).
- Z* is the best objective value (maximum or minimum depending on your selection).
- x1…xn are decision variables. Their values are the recommended amounts/levels at the optimum.
- Multiple optimal means there are multiple solutions that achieve the same Z*.
Common mistakes
- Forgetting the calculator assumes xᵢ ≥ 0.
- Swapping ≤ and ≥ signs (changes the feasible region completely).
- Getting Unbounded because real-world caps/limits were not modeled (use upper bounds or additional constraints).
- Choosing integer/binary without tight bounds (Branch & Bound can grow fast).
Limitations
This is a teaching/utility LP/ILP solver. It does not model nonlinear relationships, uncertainty, or industry-specific feasibility rules. For high-stakes decisions, validate using a production solver and your full constraint set.
FAQs
Use the RankMath FAQ block below.
Sources
How this calculator works (methodology)
1) What you enter (the mathematical model)
You provide: (a) an objective function (maximize or minimize), (b) constraints of the form A x ≤ b, A x ≥ b, or A x = b, and (c) optional upper bounds xᵢ ≤ Uᵢ. The calculator always assumes xᵢ ≥ 0.
Standard LP form (conceptual):
Max/Min: Z = cᵀx
Subject to A x (≤, ≥, =) b
x ≥ 0
Optional: xᵢ ≤ Uᵢ
2) Standard-form conversion (how constraints become solver-ready)
Simplex methods require a starting “basic feasible solution”. To build that, each constraint is converted:
- ≤ constraint: add a slack variable (turns ≤ into =).
- ≥ constraint: subtract a surplus variable and add an artificial variable (to start feasibility).
- = constraint: add an artificial variable (to start feasibility).
Examples: 1) aᵀx ≤ b ⇒ aᵀx + s = b, s ≥ 0 (slack) 2) aᵀx ≥ b ⇒ aᵀx - s + a = b, s ≥ 0, a ≥ 0 (surplus + artificial) 3) aᵀx = b ⇒ aᵀx + a = b, a ≥ 0 (artificial)
3) Two‑Phase simplex (default)
When artificial variables are required, the calculator uses Two‑Phase simplex:
- Phase 1: minimize the sum of artificial variables. If the minimum is not 0, the original model is infeasible.
- Phase 2: optimize your original objective starting from the feasible basis found in Phase 1.
4) Other modes
- Big‑M (decimal): penalizes artificials heavily; includes a check that artificial variables are near zero.
- Dual simplex (decimal): works when the tableau is dual-feasible and there are no artificial variables.
- Branch & Bound (integer/binary): solves LP relaxations, then branches on fractional variables to prove an integer optimum.
- Graphical (N=2): enumerates corner points. A verification solve is used to detect unbounded/infeasible cases.
5) Exact vs Decimal engine
- Exact (rational): keeps fractions exactly (best for teaching and accuracy).
- Decimal: faster but uses tolerances (good for quick checks).
6) Why the “Beginner mode” steps are trustworthy
In Beginner mode, the calculator prints a verification table that plugs the solution into every constraint (and bounds / integrality rules). This is the easiest way for a layperson to confirm “yes, this output really satisfies the model.”
Related and other calculators
Explore related tools and browse by category:
VAM / NW corner / least cost + MODI/Stepping Stone optimization with steps.
BMI, calorie, BMR and more—quick tools for everyday decisions.
Algebra, statistics, matrices and more—step-by-step learning tools.
Loans, interest, ROI and planning—fast estimates with clear outputs.