Contents  |  ‹ Previous  |  Next ›  |  Download EPUB  |  PDF

Chapter 8
Simplex - Matrix Calculations

In the previous chapter we ran the simplex method through dictionaries: rewrite, pivot, repeat. That view is good for intuition. In this chapter we work out the linear algebra behind it. Every dictionary you wrote is a statement about matrices: choosing a basis means selecting an invertible submatrix AB, pivoting means changing that submatrix, and the objective row of a dictionary is a vector of reduced costs computed from AB−1. Making this precise explains why the method works, and it is how simplex is implemented in software, where solvers manipulate basis matrices rather than rewrite equations.

We proceed in two steps. Section 8.1 shows how partitioning variables into basic and nonbasic sets turns Ax = b into a formula for basic solutions. Section 8.2 then rewrites the objective from the perspective of a basis, giving an algebraic certificate of optimality.

8.1 Solutions to Ax = b

Learning Outcomes

We will now explore ways to represent solutions to this linear system of equations. This is meant to give the theoretical backbone of the simplex algorithm.

We consider a linear system

Ax = b,

where A ∈ ℝm×n, x ∈ ℝn, and b ∈ ℝm. Explicitly,

A = [ a11 ⋯ a1n ⋮ ⁡ ⋱ ⋮ ⁡ a m1 ⋯ amn ] ,x = [ x1 ⋮ ⁡ x n ] ,b = [ b1 ⋮ ⁡ b m ] .

Assumptions on A

We assume:

If A lacked full row rank, some equations would be redundant and removable without changing the solution set. When m > n, the system is typically overdetermined and inconsistent; if consistent, it can be reduced to m ≤ n via row operations.

Under these assumptions, Ax = b represents a system of m independent equations in n unknowns with a feasible (possibly infinite) solution space.

Example Problem - Small Bakery

A small bakery produces two products: loaves of bread (denoted by x) and cakes (denoted by y). Each loaf of bread contributes $2 in profit, while each cake contributes $3 in profit. The bakery must operate under the following daily constraints:

Model:

The bakery wants to determine how many loaves of bread ( x) and cakes ( y) to produce each day in order to maximize total profit. The resulting linear program is:

max ⁡ 2x + 3y  s.t.  x + y ≤ 9 (hours) 2x + y ≤ 16 (flour) x + 2y ≤ 14 (sugar) x ≥ 0,y ≥ 0.

We begin by adding slack variables s1,s2,s3 to convert the inequalities to equalities:

max ⁡ 2x + 3y  s.t.  x + y + s1 = 9 (hours) 2x + y + s2 = 16 (flour) x + 2y + s3 = 14 (sugar) x,y,s1,s2,s3 ≥ 0

It will be useful to also understand standard form from the matrix perspective.

In matrix-vector notation, define:

x = [ x y s1 s2 s3 ] ,c = [ 2 3 0 0 0 ],A = [ 1 1 1 0 0 2 1 0 1 0 1 2 0 0 1 ],b = [ 9 16 14 ]

The standard form linear program is then:

max ⁡ c⊤ ⁡x  s.t.  Ax = b, x ≥0

Submatrix Notation

We extract submatrices of A by selecting columns corresponding to specific variable sets. For a set I, we let AI denote the submatrix of A corresponding to the columns in I.

xys1s2s3 [ 11100 2 1 0 1 0 12001{\columncolor {yellow}}c c c c c--> ] ⇒A{x} = [ 1 2 1 ]
xys1s2s3 [ 11100 2 1 0 1 0 12001 ] ⇒A{y,s2} = [ 1 0 1 1 2 0 ]
xys1s2s3 [ 11100 2 1 0 1 0 12001 ] ⇒A{s1,s2,s3} = [ 1 0 0 0 1 0 0 0 1 ]

Ax = [ 1 1 1 0 0 2 1 0 1 0 1 2 0 0 1 ] [ x y s1 s2 s3 ] = [ 1x + 1y + 1s1 2x + 1y + 1s2 1x + 2y + 1s3 ] = [ 1 1 2 1 1 2 ] [ x y ]︸ A{x,y}(x,y) + [ 1 0 0 0 1 0 0 0 1 ] [ s1 s2 s3 ]︸ A{s 1,s2,s3}(s1,s2,s3)

Ax = [ 1 1 0 2 1 1 1 2 0 ] [ x y s2 ]︸ A{x,y,s 2}(x,y,s2) + [ 1 0 0 0 0 1 ] [ s1 s3 ]︸ A{s1,s3}(s1,s3) = [ 9 16 14 ]

This implies:

A{x,y,s2} [ x y s2 ] = [ 9 16 14 ] − A{s1,s3} [ s1 s3 ]

So,

[ x y s2 ] = A{x,y,s2}−1 ( [ 9 16 14 ] − A{s1,s3} [ s1 s3 ] )

8.1.1 Partitioning the Variables

In solving the system Ax = b in the context of linear programming, we introduce the concept of partitioning the variables. This approach is essential in the Simplex Method for identifying and analyzing basic solutions.

Definition 8.1: Basis

Given a matrix A of full row rank m, a basis B is an index set of m of the n columns such that the corresponding m columns of the matrix A are linearly independent. We then form the submatrix AB that contains only those columns of A.

The remaining n − m columns are referred to as the nonbasic columns, which form the matrix AN.

Given a basis B and the nonbasic set N, this partitions the variable vector x into two sets:

x = [ xB xN ] ,

where:

Rewriting the system Ax = b in terms of these partitions gives:

ABxB + ANxN = b. (8.1)

If the basis matrix AB is invertible, we can express xB in terms of xN:

xB = AB−1b − A B−1A NxN. (8.2)

Definition 8.2: Basic solution and Basic Feasible Solution (BFS)

A basic solution is obtained by setting xN = 0, yielding:

xB = AB−1b,x N = 0. (8.3)

A basic feasible solution (BFS) is a basic solution that satisfies the nonnegativity constraint xB ≥0, ensuring that all basic variables are nonnegative.

Example 1: A 3-variable, 2-equation System

Consider the following system:

x1 + 2x2 + x3 = 4, 3x1 + x2 + 2x3 = 5.

Here, the matrix A and the variable vector x are:

A = [ 1 2 1 3 1 2 ],x = [ x1 x2 x3 ] ,b = [ 4 5 ].

Selecting B = {1,2} as the basis, the corresponding submatrix is:

AB = [ 1 2 3 1 ],AN = [ 1 2 ].

If AB is invertible, we compute:

AB−1 = [ −1∕5 2∕5 3∕5 −1∕5 ].

Setting x3 = 0 (i.e., xN = 0), we solve for xB:

xB = AB−1b = [ −1∕5 2∕5 3∕5 −1∕5 ] [ 4 5 ] = [ 6∕5 7∕5 ].

Since xB ≥ 0, this is a basic feasible solution.

Example 2: A System with Slack Variables

Consider a linear program in inequality form:

x1 + 3x2 ≤ 6, 2x1 + x2 ≤ 4.

We introduce slack variables s1,s2 ≥ 0 to convert inequalities into equalities:

x1 + 3x2 + s1 = 6, 2x1 + x2 + s2 = 4.

The augmented system has:

A = [ 1 3 1 0 2 1 0 1 ],x = [ x1 x2 s1 s2 ] ,b = [ 6 4 ].

Choosing the slack variables as the basis ( B = {s1,s2}), the basis matrix is:

AB = [ 1 0 0 1 ],AN = [ 1 3 2 1 ].

Since AB is the identity matrix, its inverse is itself, and we obtain:

xB = AB−1b = [ 6 4 ],xN = 0.

Since xB ≥ 0, this is a basic feasible solution.

8.1.2 Another Example

To convert the given problem into standard form, we introduce slack variables s1,s2 to convert the inequalities into equalities.

max ⁡ 2x1 + 5x2  s.t.  x1 + 2x2 + s1 = 16, 5x1 + 3x2 + s2 = 45, x1,x2,s1,s2 ≥ 0.

Now the system is in standard form:

[ 1 2 1 0 5 3 0 1 ] [ x1 x2 s1 s2 ] = [ 16 45 ],x1,x2,s1,s2 ≥ 0.

8.1.3 Selecting and Evaluating Different Bases

A basis consists of any two linearly independent columns from A. We select three different bases:

Figure 8.1 shows where these three basic solutions sit relative to the feasible region.

Feasible region shaded blue for x1+2x2<=16 (orange line) and 5x1+3x2<=45 (teal line) with corner points (0,0), (0,8), (6,5), and (9,0) marked as filled dots; labels give the basis at several points, for example B={x1,x2} at (6,5), and the point (16,0) is drawn as an open circle labeled an infeasible basic solution.

Figure 8.1: The three bases of this subsection, seen geometrically. Each basis fixes the nonbasic variables at zero, which places the basic solution at the intersection of two constraint boundaries. Bases {x1,x2} and {s1,s2} give basic feasible solutions at the vertices (6,5) and (0,0) (filled dots). Basis {x1,s2} gives the basic solution (16,0) (open dot), the intersection of the x1-axis ( x2 = 0) with the boundary x1 + 2x2 = 16 ( s1 = 0); it violates 5x1 + 3x2 ≤ 45, so it is an infeasible basic solution and lies outside the region.

8.2 Optimality Conditions

Learning Outcomes

The objective function of the linear program is given by:

z = c⊤ ⁡x.

Substituting the partitioned variables xB and xN,

z = cB⊤ ⁡x B + cN⊤ ⁡x N.

Expressing xB in terms of xN, using the basic solution xB = AB−1b − AB−1ANxN, we rewrite the objective function as:

z = cB⊤ ⁡(A B−1b − A B−1A NxN) + cN⊤ ⁡x N. (8.4)

Expanding and regrouping terms:

z = cB⊤ ⁡A B−1b + (c N⊤ ⁡−c B⊤ ⁡A B−1A N)xN. (8.5)

Definition 8.3: Reduced Costs

The term cN⊤ ⁡−cB⊤ ⁡AB−1AN represents the reduced costs.

This is explained as the objective rewritten from the viewpoint of a basic feasible solution. In particular, these are the coefficients on the non-basic variables.

The system is rewritten as the dictionary form at basis B as in the following definition.

Definition 8.4: Revised Simplex Dictionary at basis B

The revised simplex dictionary at a basis B is

maxcB⊤A B−1b + (c N⊤−c B⊤A B−1A N)xN  s.t.  xB = AB−1b −A B−1A NxN. x ≥ 0 (8.6)

Here is an example: the same linear program written first at the slack basis and then at the basis {x,y}.

max ⁡ 2x + y  s.t.  s1 = 23 − 3x − y, s2 = 45 − 5x − 3y, x,y,s1,s2 ≥ 0.
max ⁡ 17 − 0.25s1 − 0.25s2  s.t.  x = 6 − 0.75s1 + 0.25s2, y = 5 + 1.25s1 − 0.75s2, x,y,s1,s2 ≥ 0.

Theorem 8.5: Optimality Condition in Simplex Method

Given a linear program in standard form:

max ⁡ c⊤ ⁡x s.t. Ax = b,x ≥ 0,

let B be a basis corresponding to a basic feasible solution xB = AB−1b, with nonbasic variables xN = 0.

If all reduced costs satisfy:

cN⊤ ⁡−c B⊤ ⁡A B−1A N ≤ 0,

then the current basic feasible solution is optimal.

Proof. Let x¯ = (x¯B,x¯N) = (AB−1b,0).

If all reduced costs are nonpositive, i.e.,

cN⊤ ⁡−c B⊤ ⁡A B−1A N ≤ 0,

then for any feasible choice of xN ≥ 0, we have

c⊤ ⁡x = c B⊤ ⁡A B−1b + (c N⊤ ⁡−c B⊤ ⁡A B−1A N)xN (8.7) = c⊤ ⁡x¯ + (c N⊤ ⁡−c B⊤ ⁡A B−1A N)xN (8.8) ≤c⊤ ⁡x¯, (8.9)

where the last line follows since (cN⊤ ⁡−cB⊤ ⁡AB−1AN) ≤ 0 and xN ≥ 0.

Thus, x¯ is an optimal solution! □

A note on sign conventions. The three treatments of the simplex method in this book state the same optimality test in three ways. In the dictionary form of Chapter 7, we improve the solution by increasing a nonbasic variable with a positive coefficient in the objective row, and we stop when there is none. The theorem above says the same thing in matrix language: those coefficients are the reduced costs cN⊤ ⁡−cB⊤ ⁡AB−1AN, and the solution is optimal once they are all ≤ 0. In the tableau form of Chapter 9, the objective is stored as the equation z −c⊤ ⁡x = 0, which flips the signs of these coefficients, so there you look for negative z-row entries and stop when every entry is nonnegative. All three are the same test.

Example 8.6: Verifying Optimality Using Reduced Costs

We use reduced costs to determine whether each of the basic feasible solutions (6,5) and (0,8) is optimal for the following linear program:

max ⁡ 2x1 + 5x2  s.t.  x1 + 2x2 + s1 = 16, 5x1 + 3x2 + s2 = 45, x1,x2,s1,s2 ≥ 0.

Solution

Checking Optimality of (6,5)

Step 1 — Identify the Basis.  At the point (x1,x2) = (6,5), we see that (s1,s2) = 0. Thus, we can choose B = {x1,x2} and N = {s1,s2}, so:

AB = [ 1 2 5 3 ],cB⊤ ⁡ = [ 2 5 ].

The nonbasic variables are s1,s2, so:

AN = [ 1 0 0 1 ],cN⊤ ⁡ = [ 0 0 ].

Step 2 — Compute AB−1. 

AB−1 = 1 (1)(3) − (2)(5) [ 3 −2 −5 1 ] = [ −3∕7 2∕7 5∕7 −1∕7 ].

Thus, the system can be written as

xB = AB−1b − A B−1A NxN,

that is

[ x1 x2 ]= [ 6 5 ]− [ −3∕7 2∕7 5∕7 −1∕7 ] [ s1 s2 ] , (8.10)

or equivalently

[ x1 x2 ]= [ 6 5 ]−s1 [ −3∕7 5∕7 ]−s2 [ 2∕7 −1∕7 ] (8.11)

Step 3 — Compute Reduced Costs. 

AB−1A N = [ −3∕7 2∕7 5∕7 −1∕7 ].
cN⊤ ⁡−c B⊤ ⁡A B−1A N = [ 0 0 ]− [ 2 5 ] [ −3∕7 2∕7 5∕7 −1∕7 ].

Computing:

[ 0 0 ]− [ (2)(−3 7) + (5)(5 7) (2)(2 7) + (5)(−1 7) ] = [ 0 0 ]− [ 19 7 −1 7 ] = [ −19 7 1 7 ] .

The reduced cost on s2 is positive ( 1 7 > 0), so (6,5) is not optimal: increasing s2 improves the objective.

Verifying Optimality of (0,8)

Step 1 — Identify the Basis. 

At the point (x1,x2) = (0,8) we have s1 = 16 − 2(8) = 0 and s2 = 45 − 3(8) = 21, so the basic variables are x2 and s2. We choose B = {x2,s2}, so:

AB = [ 2 0 3 1 ],cB⊤ ⁡ = [ 5 0 ].

The nonbasic variables are x1,s1, so:

AN = [ 1 1 5 0 ],cN⊤ ⁡ = [ 2 0 ].

Step 2 — Compute AB−1. 

AB−1 = 1 (2)(1) − (0)(3) [ 1 0 −3 2 ] = [ 1 2 0 −3 2 1 ].

As a check, AB−1b = (16 2 , − 3 2(16) + 45) = (8,21), matching (x2,s2) = (8,21) ≥ 0: a basic feasible solution.

Step 3 — Compute Reduced Costs. 

AB−1A N = [ 1 2 0 −3 2 1 ] [ 1 1 5 0 ] = [ 1 2 1 2 7 2 −3 2 ] .
cN⊤ ⁡−c B⊤ ⁡A B−1A N = [ 2 0 ]− [ 5 0 ] [ 1 2 1 2 7 2 −3 2 ] = [ 2 0 ]− [ 5 2 5 2 ] = [ −1 2 −5 2 ] .

Since both reduced costs are negative, this confirms that (0,8) is an optimal solution.

Conclusion

The reduced-cost computation we just carried out is the algebraic version of a picture worth revisiting: every vertex of the feasible region has its own dictionary, and the signs of its reduced costs say whether a better neighbor exists. See Figure 7.4 in Section 7.3 for that vertex-by-vertex view.

Resources

8.3 Exercises

Warm-ups

Exercise 8.7: Basis matrix and basic solution

⋆  Consider the system from Example 1,

x1 + 2x2 + x3 = 4, 3x1 + x2 + 2x3 = 5,

and take the basis B = {x2,x3}.

1.
Write down the basis matrix AB and compute AB−1.
2.
Compute the basic solution xB = AB−1b with x1 = 0.
3.
Is this basic solution a basic feasible solution?

[§8.1, Example 1]

Exercise 8.8: A basic solution that is not feasible

⋆  For the same system as Exercise 8.7, take the basis B = {x1,x3}. Compute AB, AB−1, and the basic solution, and explain why this basis gives a basic solution that is not feasible.

[§8.1, Example 1]

Exercise 8.9: A fourth basis for the three-bases example

⋆  In Section 8.1.3 we evaluated the bases {x1,x2}, {x1,s2}, and {s1,s2} of the system

[ 1 2 1 0 5 3 0 1 ] [ x1 x2 s1 s2 ] = [ 16 45 ].

Now evaluate the basis B = {x2,s2}: compute AB, AB−1, and the basic solution, and decide whether it is feasible. Which point (x1,x2) does this basis correspond to?

[§8.1.3]

Core problems

Exercise 8.10: Reduced costs at two bases

⋆ ⋆  Consider the bakery linear program of Section 8.1 in standard form,

A = [ 1 1 1 0 0 2 1 0 1 0 1 2 0 0 1 ],b = [ 9 16 14 ],c⊤ ⁡ = [ 2 3 0 0 0 ],

with variables ordered (x,y,s1,s2,s3). For each of the bases

B1 = {y,s1,s2}andB2 = {x,y,s2},

compute AB−1, the basic solution xB = AB−1b, the objective value cB⊤ ⁡AB−1b, and the reduced costs cN⊤ ⁡−cB⊤ ⁡AB−1AN. Use the optimality condition to decide whether each basis is optimal.

[§8.2, §8.1]

Exercise 8.11: Which bases are feasible?

⋆ ⋆  For the 2 × 4 system

[ 1 2 1 0 5 3 0 1 ] [ x1 x2 s1 s2 ] = [ 16 45 ],x1,x2,s1,s2 ≥ 0,

there are 4 2 = 6 ways to choose two columns.

1.
Verify that every one of the six column pairs is linearly independent, so each choice is a basis.
2.
For each basis, compute the basic solution and classify it as feasible or infeasible.
3.
Give an example of a 2 × 4 matrix in which some pair of columns does not form a basis.

[§8.1.3, Figure 8.1]

Exercise 8.12: Rebuilding a dictionary from the formula

⋆ ⋆  Section 8.2 displays the linear program

max ⁡ 2x + y  s.t.  3x + y + s1 = 23, 5x + 3y + s2 = 45, x,y,s1,s2 ≥ 0,

together with its dictionary at the basis B = {x,y}. Using the revised simplex dictionary formula (8.6), compute AB−1, AB−1b, AB−1AN, and the reduced costs, and confirm that the formula reproduces the displayed dictionary

max ⁡ 17 − 0.25s1 − 0.25s2  s.t.  x = 6 − 0.75s1 + 0.25s2, y = 5 + 1.25s1 − 0.75s2.

[§8.2]

Concepts and connections

Exercise 8.13: Reduced costs of basic variables

⋆ ⋆  The reduced-cost vector of the nonbasic variables is cN⊤ ⁡−cB⊤ ⁡AB−1AN. Apply the same formula to the basic columns: show that

cB⊤ ⁡−c B⊤ ⁡A B−1A B = 0⊤ ⁡,

so every basic variable has reduced cost exactly zero. Explain what this says about the dictionary at basis B: why can a basic variable never appear in the objective row?

[§8.2]

Exercise 8.14: Reduced-cost signs and the entering rule

⋆ ⋆  In the dictionary form of Chapter 7, the entering variable is a nonbasic variable with a positive coefficient in the objective row, while the optimality theorem of this chapter stops when all reduced costs are ≤ 0.

1.
Explain why these are the same rule: show that the objective-row coefficient of a nonbasic variable in a dictionary is its reduced cost cj −cB⊤ ⁡AB−1A{j}.
2.
A positive reduced cost signals an improving direction. Describe geometrically what happens to the solution when that variable increases from zero.
3.
The tableau form of Chapter 9 instead looks for negative z-row entries. Using the sign-convention paragraph of §8.2, explain why no contradiction arises.

[§8.2, sign-convention paragraph; §8.2]

Challenge problems

Exercise 8.15: Strictly negative reduced costs imply a unique optimum

⋆ ⋆⋆  Let B be a basis of an LP in standard form whose basic solution x¯ = (AB−1b,0) is feasible, and suppose every reduced cost is strictly negative:

cN⊤ ⁡−c B⊤ ⁡A B−1A N < 0⊤ ⁡(componentwise).

Prove that x¯ is the unique optimal solution of the LP. (This is an argument, not a computation. Suggested route: take any feasible x≠x¯, write c⊤ ⁡x = c⊤ ⁡x¯ + (cN⊤ ⁡−cB⊤ ⁡AB−1AN)xN, and consider the two cases xN = 0 and xN≠0.)

[§8.2, Optimality Condition theorem]

Selected Solutions

Solution

(Exercise 8.7) The columns of x2 and x3 give

AB = [ 2 1 1 2 ],AB−1 = 1 3 [ 2 −1 −1 2 ].

The basic solution is

xB = AB−1b = 1 3 [ 2 −1 −1 2 ] [ 4 5 ] = 1 3 [ 3 6 ] = [ 1 2 ],

so (x1,x2,x3) = (0,1,2). Both basic variables are nonnegative, so this is a basic feasible solution.

Solution

(Exercise 8.10) Basis B1 = {y,s1,s2}. Ordering the basic variables (y,s1,s2),

AB1 = [ 1 1 0 1 0 1 2 0 0 ],xB1 = AB1−1b = [ 7 2 9 ],

so y = 7, s1 = 2, s2 = 9: a basic feasible solution with objective value cB1⊤ ⁡xB1 = 3 ⋅ 7 = 21. The nonbasic variables are x and s3, and the reduced costs work out to

cN⊤ ⁡−c B1⊤ ⁡A B1−1A N = [ 1 2 −3 2 ] .

The reduced cost of x is 1 2 > 0, so B1 is not optimal; this matches the second dictionary of Chapter 7, z = 21 + 1 2x − 3 2s3.

Basis B2 = {x,y,s2}. Here

AB2 = [ 1 1 0 2 1 1 1 2 0 ],xB2 = AB2−1b = [ 4 5 3 ],

a basic feasible solution with value 2 ⋅ 4 + 3 ⋅ 5 = 23. The nonbasic variables are s1 and s3, with reduced costs

cN⊤ ⁡−c B2⊤ ⁡A B2−1A N = [ −1 −1 ] ≤0⊤ ⁡,

so B2 is optimal, matching the final dictionary z = 23 − s1 − s3.

Solution

(Exercise 8.15) Write c¯N⊤ ⁡ = cN⊤ ⁡−cB⊤ ⁡AB−1AN and z∗ = c⊤ ⁡x¯ = cB⊤ ⁡AB−1b. Every feasible x satisfies ABxB + ANxN = b, so xB = AB−1b − AB−1ANxN and, exactly as in the optimality theorem,

c⊤ ⁡x = z∗ + c¯ N⊤ ⁡x N.

Take any feasible x≠x¯.

Case 1: xN≠0. Then some component xj > 0 with j ∈ N, and since every entry of c¯N is strictly negative, c¯N⊤ ⁡xN < 0. Hence c⊤ ⁡x < z∗, so x is not optimal.

Case 2: xN = 0. Then ABxB = b, and since AB is invertible this forces xB = AB−1b, i.e., x = x¯, contradicting x≠x¯.

Therefore every feasible point other than x¯ has objective value strictly less than z∗: the solution x¯ is optimal and no other optimal solution exists.

© 2026 Robert Hildebrand and contributors · Licensed CC BY-SA 4.0 · Sources and attribution · Book home