Linear programming — simplex method (intro)
WHAT is a linear program?
WHY this form? Every "≥" constraint becomes "≤" by multiplying by ; equalities split into two inequalities; minimization is maximization. So this one form is fully general.
HOW we make inequalities into equations: slack variables
WHY do this? Equations are easy to solve with linear algebra (Gaussian elimination). Corners of the polytope correspond to setting some variables to and solving the rest — slacks give us a clean bookkeeping system to do exactly that.
Deriving the simplex tableau from scratch
Take the example below to build everything by hand.
Step 1 — Add slacks. Why? To get equations.
Step 2 — Initial tableau. Why? The basic variables are (set ); this gives the corner with — a valid starting vertex because .
| Basis | RHS | ||||
|---|---|---|---|---|---|
| 1 | 1 | 1 | 0 | 4 | |
| 1 | 3 | 0 | 1 | 6 | |
| 0 | 0 | 0 |
Step 3 — Choose entering variable. Why? The bottom row reads . A negative entry under means increasing raises . Pick the most negative: enters.
Step 4 — Ratio test (leaving variable). Why? We push up, but a constraint will bind first. Compute : row 1 , row 2 . The smallest ratio wins (row 1) — going further makes (infeasible). So leaves.
Step 5 — Pivot on the -row1 entry (=1). Why? Make that column a unit vector so becomes basic. Row1 stays; Row2 Row2 − Row1; -row -row Row1.
| Basis | RHS | ||||
|---|---|---|---|---|---|
| 1 | 1 | 1 | 0 | 4 | |
| 0 | 2 | 1 | 2 | ||
| 0 | 1 | 3 | 0 | 12 |
Now corner is , . Bottom row has no negative entries → optimal!

Verify graphically: Vertices are , , , intersection of the two lines . Maximum is indeed at .
WHY the simplex method works (Steel-man the logic)
- Maximum is at a vertex — Because is linear, its level sets are parallel hyperplanes; sliding in the improving direction, you stop at the polytope's boundary, ending at a corner.
- Each pivot is a corner-to-corner move along an edge that increases .
- Finitely many corners ⇒ the process terminates (ignoring rare degeneracy).
A second worked example (minimization via negation)
Flashcards
What shape is the feasible region of an LP?
Where does a linear objective attain its optimum?
What is a slack variable?
In a max-problem tableau, which variable enters?
How do you choose the leaving variable?
When do you stop the simplex method (maximization)?
Why only use positive entries in the ratio test?
How is a minimization LP handled?
What does a basic feasible solution correspond to geometrically?
How do you convert a constraint to standard form?
Recall Feynman: explain to a 12-year-old
Imagine a fenced playground shaped like a many-cornered field. You want to stand where the ground is highest, but the ground tilts flatly like a ramp. The highest spot on a flat ramp inside a fenced field is always at a corner of the fence. So you start at one corner and keep walking to the next corner only if it's higher. When no neighbour corner is higher, you're standing on the top — done! That walking-along-the-fence trick is the simplex method.
Connections
- Convex Sets and Polytopes — why optima sit at vertices.
- Gaussian Elimination — pivoting is row reduction with a feasibility rule.
- Duality in Linear Programming — every LP has a partner; optimal values match.
- Gradient and Level Sets — geometry of why linear objectives slide to boundaries.
- Integer Programming — what changes when variables must be whole numbers.
- Optimization (Lagrange Multipliers) — the smooth-constraint cousin.
Concept Map
Hinglish (regional understanding)
Intuition Hinglish mein samjho
Dekho, Linear Programming ka idea simple hai: tumhe ek profit function (jaise ) ko maximize karna hai, lekin kuch constraints (inequalities) ke andar rehkar. Ye saari inequalities milke ek polygon/polytope banati hain — yahi tumhara "feasible region" hai. Sabse important baat: linear objective ka maximum hamesha is region ke kisi corner (vertex) pe milta hai, beech mein kabhi nahi. Isliye humein infinite points check karne ki zaroorat nahi — sirf corners dekhne hain.
Simplex method bas ek smart corner-hopping technique hai. Pehle har constraint mein ek slack variable add karte hain taaki inequality ek clean equation ban jaye ( ka matlab "bachi hui jagah / unused resource"). Phir hum origin se start karte hain (sab slacks basic). Ab entering variable chunte hain — jiska -row mein coefficient sabse negative ho (kyunki use badhane se profit sabse zyada badhega). Phir ratio test se decide karte hain konsa variable leave karega — sabse chhota RHS÷(positive entry). Pivot karke naye corner pe pahunch jaate hain.
Repeat karte raho jab tak -row mein koi negative number na bache — uss waqt tum optimal corner pe ho, game over! Common galti: ratio test mein negative ya zero entries use kar dena (sirf positive lo), ya minimization mein bhi most-negative dhoondte rehna — minimization ke liye objective ko se multiply karke maximize karo. Exam aur real-life dono mein (cost minimize, profit maximize, resource allocation) ye method gold hai.