Two-Phase Method

When the starting basis needs artificial variables, the two-phase method uses 2 separate simplex runs, avoiding the arbitrary constant MM of the Big-M method.

Phase 1

  • Replace the original objective with minimizing the sum of all artificial variables. This is the same regardless of whether the original problem maximizes or minimizes; the original objective’s direction plays no role in phase 1.
  • Run the simplex algorithm.
  • If the minimum is 0, a basic feasible solution to the original problem was found; proceed to phase 2.
  • If the minimum is positive, the original problem is infeasible. Stop.

Phase 2

  • Drop the artificial variables and restore the original objective. The original direction only matters here: convert a minimization to max⁡ −z\max\ {-z} to fit the tableau convention, or use a maximization objective as is.
  • Use the phase 1 optimal basis as the starting basic feasible solution: keep the same basic variables and the same rows (with the artificial columns dropped) from the phase 1 final tableau, and only replace the objective row with the restored objective, priced out against those same rows.
  • Run the simplex algorithm to optimize the original objective.

Unbounded and alternate/infinite optimal solutions are detected in phase 2 the same way as in the ordinary simplex algorithm.

Worked Example

Same LP as the Big-M worked example: minimize z=4x1+x2z = 4x_1 + x_2 subject to 3x1+x2=33x_1 + x_2 = 3, 4x1+3x2≥64x_1 + 3x_2 \ge 6, x1+2x2≤4x_1 + 2x_2 \le 4, x1,x2≥0x_1, x_2 \ge 0. Standard form adds a surplus s2s_2, a slack s3s_3, and artificials a1,a2a_1, a_2: 3x1+x2+a1=33x_1 + x_2 + a_1 = 3, 4x1+3x2−s2+a2=64x_1 + 3x_2 - s_2 + a_2 = 6, x1+2x2+s3=4x_1 + 2x_2 + s_3 = 4.

Phase 1 Tableau

Objective becomes min⁡ a1+a2\min\ a_1 + a_2, i.e. max⁡ w\max\ w with w=−a1−a2w = -a_1 - a_2. The natural starting basis is again (a1,a2,s3)=(3,6,4)(a_1, a_2, s_3) = (3, 6, 4).

1 /

entering column leaving row pivot element updated this step

Basis (a1,a2,s3)=(3,6,4)(a_1, a_2, s_3) = (3, 6, 4). But a1,a2a_1, a_2 are basic with coefficient 11 in the ww row, so it isn’t canonical yet: subtract the a1a_1 row and the a2a_2 row from the ww row to zero them out.

ww row after eliminating a1,a2a_1, a_2: w=−9w = -9. Coefficients −7-7 and −4-4 are negative, so not optimal.

Most negative is −7-7, so x1x_1 enters. Minimum ratio is 11 in row a1a_1, so a1a_1 leaves. Pivot element is 33.

Coefficient −5/3-5/3 is negative, so x2x_2 enters. Minimum ratio is 1.21.2 in row a2a_2, so a2a_2 leaves. Pivot element is 5/35/3.

w=0w = 0 and all coefficients are non-negative. Both artificials are non-basic, so (x1,x2,s3)=(3/5,6/5,1)(x_1, x_2, s_3) = (3/5, 6/5, 1) is a basic feasible solution of the original problem.

Phase 2 Tableau

Drop columns a1,a2a_1, a_2. Restore max⁡ −z\max\ -z with −z=−4x1−x2-z = -4x_1 - x_2. Carry over the phase 1 final basis (x1,x2,s3)=(3/5,6/5,1)(x_1, x_2, s_3) = (3/5, 6/5, 1), columns x1,x2,s2,s3x_1, x_2, s_2, s_3 only.

1 /

entering column leaving row pivot element updated this step

Basis (x1,x2,s3)=(3/5,6/5,1)(x_1, x_2, s_3) = (3/5, 6/5, 1), carried over from the phase 1 final tableau. But x1,x2x_1, x_2 are basic with nonzero coefficients 44 and 11 in the objective row, so it isn’t canonical yet: subtract 4×(x1 row)4 \times (x_1 \text{ row}) and 1×(x2 row)1 \times (x_2 \text{ row}) to zero them out.

Objective row after eliminating x1,x2x_1, x_2. Coefficient −1/5-1/5 in column s2s_2 is negative, so not optimal.

s2s_2 enters. Minimum ratio is 11 in row s3s_3, so s3s_3 leaves. Pivot element is 11.

All objective coefficients are non-negative. Optimal at x1=2/5x_1 = 2/5, x2=9/5x_2 = 9/5, so z=17/5=3.4z = 17/5 = 3.4, matching the Big-M result.

Wolfram Mathematica notebooks

A companion notebook for this note. Open it in Mathematica and evaluate the cells to reproduce the worked example.

The summary notebook defines every function used in this module, with documentation and no examples, as a starting point for your own problems.

Written by October 24, 2026 3 min read
Was this helpful?