The simplex algorithm is a method for finding the largest or smallest value of a linear objective under linear inequality constraints. It starts at one corner of the feasible region and moves along edges to neighboring corners that improve the objective. It stops when no neighboring corner does better, or when it finds that the objective can grow without limit (an unbounded problem).
Consider a linear program maxcTx subject to Ax≤b, x≥0, with b≥0. Add slack variables s≥0 so the constraints become Ax+s=b. The simplex method moves through basic feasible solutions. In each pivot, one nonbasic variable enters the basis and one basic variable leaves it. The entering variable is one whose coefficient is positive when z is written in terms of the nonbasic variables. In a tableau whose bottom row is z−cTx=0, this shows up as a negative entry. The leaving variable is the one with the smallest ratio bi/aij over rows with aij>0. The method stops in one of two ways. If no such coefficient is positive (no negative entry in the tableau's bottom row), the current solution is optimal. If the entering column has no positive entry, the problem is unbounded. An anti-cycling rule such as Bland's rule guarantees that the method finishes.
Worked Example
Problem: Maximize z=5x+4y subject to x+y≤5, 2x+y≤8, and x,y≥0. Step 1: Add slack variables s1,s2≥0 to turn the inequalities into equations. Start at the corner x=y=0, where z=0. Both objective coefficients are positive, so you can still improve z. Pick x to enter because it has the larger coefficient.x+y+s1=5,2x+y+s2=8 Step 2: Use the ratio test to decide how far x can increase. Row 1 allows 5/1=5 and row 2 allows 8/2=4. The smaller ratio is 4, so s2 leaves. Solve row 2 for x and substitute into z. The coefficient of y is still positive, so y enters next.x=4−21y−21s2,z=20+23y−25s2 Step 3: Run the ratio test for y. Now s1=1−21y+21s2, which allows 1÷21=2. The x row allows 4÷21=8. So s1 leaves. After you substitute, every coefficient in z is negative. That means no move can raise z, and the current corner is optimal.y=2−2s1+s2,x=3+s1−s2,z=23−3s1−s2 Answer: The maximum is z=23 at x=3, y=2. The path visited three corners: (0,0)→(4,0)→(3,2). Why It Matters
Simplex is the core algorithm of a first operations research course. Solvers use it to schedule airline crews, plan refinery output, and route shipments. Klee and Minty showed in 1972 that it can take exponentially many steps on specially built inputs, yet it runs fast on almost every real problem.
Common Mistakes
Mistake: Choosing the leaving variable by the largest ratio, or by the row where the entering variable first appears.
Correction: Always take the smallest nonnegative ratio, and skip rows where the entering column's entry is zero or negative. In the example, letting x=5 from row 1 would force s2=8−10=−2. That breaks s2≥0 and leaves the feasible region.