Learning Outcomes
Convert linear programs to standard form
Reformulate linear programs from the perspective of different bases
Define basic solutions and basic feasible solutions
Describe optimality condition from the perspective of a reformulation
Develop the Simplex Method that pivots through basic feasible solutions
Picture hiking to the highest point of a fenced field on a moonless night. Your flashlight shows only the ground at your feet: the corner you are standing on and the fence lines leading away from it. A sensible strategy suggests itself: shine the light along each fence line; if one leads uphill, follow it to the next corner and look again; if none does, stop. The remarkable fact of this chapter is that for linear programs this nearsighted strategy is guaranteed to end at the highest point of the entire field. The algebra of “shining the flashlight” is a reformulation of the linear program called a dictionary.
In this section, we will develop the Simplex Method. This algorithm has been lauded as one of the most important algorithms of the 20th century. It will iteratively find better vertex solutions to a linear program until it can prove optimality.
To implement the simplex algorithm, we must first discuss a Standard Form with which to represent linear programs. After, we will discuss structure of linear programs in this form using matrix notation and demonstrate how a linear program can be transformed to new representations. These new representations will be the backbone of the simplex algorithm. We will pivot between vertices, and each vertex will have a new representation of the linear program that will help us understand how to choose a new vertex to move to.
The whole algorithm runs very fast in practice. Here, we will teach you a basic version of the algorithm, but note that state-of-the-art solvers will employ a number of tricks to make this process very fast. Linear programs can be solved with millions of variables!
To solve a linear program using methods such as the simplex algorithm, the problem must first be converted to a standard form. This ensures the problem adheres to a uniform structure, making it easier to analyze and solve algorithmically.
A linear program is in standard form if it satisfies all of the following:
The objective is a maximization.
All constraints are equalities (i.e., of the form ).
All variables are bounded below by zero (i.e., ).
Definition 7.1: Standard Form
A linear program is in standard form if it is written as
We now describe how to handle each of these aspects step-by-step, including common subcases and examples.
If the linear program is given as a minimization, we convert it into a maximization by multiplying the objective function by . This transformation does not affect the feasible region, and the maximizer of the new function will be the minimizer of the original.
Example 7.2: Convert Min to Max
Consider the following objective:
To convert this to a maximization, we multiply the entire expression by :
Now the problem can be treated using standard methods that assume a maximization objective.
All inequality constraints must be transformed into equalities using slack or surplus variables, which represent the difference between the left- and right-hand sides of the constraint.
Convert to using a slack variable.
A slack variable is added to "fill the gap" in a constraint and must be nonnegative.
Example 7.3: Slack Variable for
Suppose we have the constraint:
We introduce a new variable , called a slack variable, and rewrite the constraint as:
Here, represents the unused portion of the right-hand side (i.e., how far the left-hand side is from 5).
Convert to using a surplus variable.
A surplus variable is subtracted from the left-hand side of a constraint to convert it into an equality. This variable also must be nonnegative.
Example 7.4: Surplus Variable for
Consider the constraint:
We introduce a new variable , called a surplus variable, and rewrite the constraint as:
In this case, accounts for the extra amount by which the left-hand side exceeds 3.
The standard form requires all variables to satisfy . If any variable is unbounded below or is restricted in another way, we perform a variable substitution to enforce this condition.
Convert to by renaming and negating.
If a variable is constrained to be nonpositive, we can define a new nonnegative variable as its negation.
Example 7.5: Rename and Negate for
Suppose . Define , which implies . Then substitute:
This transformation allows us to enforce nonnegativity in the standard form.
Convert unrestricted variables into the difference of two nonnegative variables.
If a variable is unrestricted in sign (i.e., it can be positive or negative), we express it as the difference of two new nonnegative variables.
Example 7.6: Unrestricted Variable to Two Variables
Suppose is unrestricted. We define:
Here, captures the positive part and captures the negative part. At most one of them will be nonzero in a basic feasible solution.
After performing these transformations, the resulting linear program will be in standard form and ready for solution via the simplex method or other standard techniques.
Example 7.7: Complete Conversion to Standard Form
Consider the following linear program:
We will now convert this problem into standard form.
Step 1: Convert the objective to maximization.
Since the problem is a minimization, we multiply the objective by :
Step 2: Replace unrestricted variables.
Both and are unrestricted. We express them as the difference of two nonnegative variables:
Substitute these into the objective and constraints.
New objective:
New constraints:
Step 3: Convert inequalities to equalities.
Add a slack variable to the first constraint:
The second constraint is already an equality:
Subtract a surplus variable from the third constraint:
Final standard form:
This is now in standard form: a maximization problem with equality constraints and all variables nonnegative.
Remark. Variable Transformations Preserve Solution Meaning To convert a linear program into standard form, we often introduce new variables:
Slack variables to convert constraints to equalities,
Surplus variables for constraints,
Split unrestricted variables as ,
Negate variables with .
These transformations may change the number of variables and the way solutions are expressed, but:
Thus, while the form of the solution may look different, the meaning and the value of the solution are preserved.
Example 7.8: Transformation Preserves Solution Meaning
Consider the following linear program:
Step 1: Convert to maximization.
Multiply the objective by :
Step 2: Convert variables to be nonnegative.
define , with .
unrestricted write , with .
Substitute into the objective and constraint:
Step 3: Convert constraint to equality using a surplus variable.
Introduce surplus variable :
Now the problem is in standard form:
Example 7.9: Example Continued
Step 4: Example solution in standard form.
Consider a solution of the canonical form
Step 5: Map solution back to original variables.
So the solution to the original problem is:
and the original objective value is:
Conclusion: The transformation allowed us to solve the LP using standard techniques, and we were able to directly interpret the solution in the space of the original variables. The solution meaning is preserved.
Consider a linear program in standard form:
where , , and .
We assume throughout that:
The matrix has full row rank, i.e., ,
The feasible region is nonempty.
Definition 7.10: Basic Feasible Solution
A vector is called a basic feasible solution (BFS) if:
Let be an index set of size such that the submatrix (formed from the columns of indexed by ) is nonsingular. Then the corresponding basic solution is given by:
where . If , the basic solution is feasible, and hence a basic feasible solution.
Basic feasible solutions play a central role in the simplex method, which moves from one BFS to another while improving the objective function value.
Example 7.11: Basic Feasible Solution
Consider the linear program:
We first convert the inequalities to equalities by introducing slack variables and :
This system has 4 variables and 2 equality constraints. A basic feasible solution corresponds to choosing any 2 variables (equal to the number of constraints) as basic and solving for them.
Choose and as the basic variables (so ). Substituting into the equations:
This gives the solution:
which is a basic feasible solution. It is feasible because all variables are nonnegative, and basic because we set two variables (equal to the number of constraints) to nonzero values.
Geometrically, this solution corresponds to the intersection of the two axes (i.e., the origin) in the plane, a corner point of the feasible region.
Learning Checkpoint 7.1.1
In a basic feasible solution (BFS) to a linear program in standard form, how many components of the decision vector can be nonzero?
[Hint: Relate your answer to the number of linearly independent constraints in the system.]
Proposition 7.1. Vertices and BFS Let be the feasible region of a linear program in standard form, where has full row rank . Then every vertex of is a basic feasible solution.
Proof. Let be a vertex of the feasible region . By definition, this means that cannot be expressed as a strict convex combination of two distinct points in . We will show that is a basic feasible solution.
Let be the support of , and let denote the submatrix of consisting of the columns indexed by . Since , and for , the vector satisfies:
If the columns of were linearly dependent, then there would exist a nonzero vector with support in such that , and for small enough , both and would remain in , contradicting the fact that is a vertex.
Therefore, the columns of must be linearly independent, and since has rank , it follows that . We can now construct a basic solution by selecting any set of indices such that:
,
,
The columns are linearly independent.
Let , and set , where . Then is a basic solution. Since for , and for , it follows that coincides with this basic solution and is nonnegative; hence it is a basic feasible solution. □
For our purposes, it’s not quite enough to have a problem in standard form. We also want to have easy access to a basic feasible solution. Thus, we like to convert linear programs to canonical form.
Definition 7.12: Canonical Form of a Linear Program
A linear program is in canonical form if:
it is in standard form:
the constraint matrix contains the identity matrix as a submatrix corresponding to some set of basic variables ,
and the right-hand side .
In this case, a basic feasible solution is immediately evident: set the basic variables , and nonbasic variables to zero.
Example 7.13: Canonical Form from Slack Variables
Consider the linear program:
We convert the constraints to equalities by introducing slack variables and :
Now the LP is in standard form with 4 variables . The constraint matrix is:
The columns corresponding to and form the identity matrix:
Hence, this LP is now in canonical form. The evident basic feasible solution is:
We can summarize these tricks in the following table.
|
|
|
|
|
|
| Nonnegativity | ||||
| Nonpositivity | ||||
| Unrestricted | ||||
| Functional () | ||||
| Functional () | ||||
| Functional () | ||||
*Indicating variable = 0 constraint boundary is satisfied; indicating variable constraint boundary is not satisfied.
We end this subsection with a motivating result.
Proposition 7.2. Existence of Canonical Form for Feasible LPs Let be a linear program in standard form:
If is feasible (i.e., such that ), then there exists an equivalent linear program in canonical form, that is, a reformulation where:
contains the identity matrix as a submatrix,
The corresponding basic variables yield a basic feasible solution with ,
The objective function is unchanged in value on feasible solutions.
Idea of Proof. Start from any feasible solution with and . Use the simplex method (or a pivoting method) to move to a basic feasible solution . Since has full rank over the feasible region, the basis matrix will be invertible. By reordering variables (i.e., choosing a new basis where ), we can express the LP in canonical form.
If no feasible solution exists, then Phase I must be used to find one (or certify infeasibility). □
Learning Outcomes
See an example of the simplex method in action
Formally state the simplex algorithm
See that changing the pivot rule can change the path to the optimal solution
Resources
Video
Interactive Simplex Method
GILP: Interactive Simplex Pivoting with Dictionary - 2D example
GILP: Interactive Simplex Pivoting with Dictionary - 3D example
Simplex Dictionary Calculator Using Python + Jupyter
Try it out visually!
Simplex Pivoter in Dictionary Form: pivot this chapter’s bakery example (or your own LP) step by step, with a practice mode that checks your entering and leaving choices.
The Simplex Algorithm jumps among the vertices of the feasible region searching for an optimal point. It does this by moving along the edges of the feasible region in such a way that the objective function is always increased after each move.
To improve the solution, we:
This process continues until no negative reduced costs remain, indicating an optimal solution.
We start with the following linear program:

To convert these inequalities to equalities, we introduce slack variables , , and . Specifically, we rewrite each constraint as follows:
with the additional nonnegativity constraints .
Hence, the linear program in standard form becomes:
When we say is the basis, we solve each equation for the corresponding slack variable:
Our initial non-basic variables are and . We will call this representation of the linear program a dictionary.
From here we can read off a basic solution that is
with
Since the basic variables are all non-negative , we call this a basic feasible solution.
Remark. Reading the Dictionary From the dictionary below, we can read off the corresponding basic solution and the objective value. The basic solution is obtained by:
Setting all nonbasic variables (those on the right-hand side of the equations, i.e., and ) equal to zero.
Reading off the values of the basic variables () from the right-hand side constants.
The dictionary is said to be feasible if all basic variables have nonnegative values (which is true here). Thus, this corresponds to a basic feasible solution:
In this subsection we assume that the slack basis gives a feasible starting dictionary; that is, setting the original variables to zero produces nonnegative values for every slack. Under this assumption, the simplex method proceeds by repeatedly choosing an entering variable whose objective-row coefficient is positive, performing the ratio test to decide which basic variable leaves, and pivoting to obtain a new dictionary. The remainder of this section walks through these three steps on the running example above.
We take as our initial basic variables the three slack variables . Geometrically, this corresponds to the point . Indeed, if and , then from the original constraints
it follows that
All are nonnegative, so is indeed a feasible basis, and is the basic feasible solution (BFS).
Thus, in “basic-variable constant (nonbasic terms)” form, our system becomes
Since are taken to be the basic variables, the nonbasic variables in this setup are and . Setting immediately gives the BFS
Value of at the BFS . At , we see , so the initial objective value is . From here, one would normally proceed with the simplex pivots to drive the objective upwards (since this is a maximization problem). We handle those pivot steps next.
We examine the objective row to determine which nonbasic variable should enter the basis. At this point, the objective is:
The nonbasic variables are and .
Both have positive coefficients, which means that increasing either variable (while staying feasible) will increase the objective value .
To decide between them, we apply a pivot rule, a strategy for selecting among eligible entering variables.
In this example, we use the Steepest Ascent rule: we choose the nonbasic variable with the largest positive coefficient in the objective row.
Between and , the coefficient of is larger ().
Therefore, we choose to enter the basis.
We hold fixed and allow to increase from . Then from the initial dictionary, the basic variables become (substituting ):
To maintain feasibility, we require all basic variables to remain nonnegative:
The tightest constraint is , which means reaches zero first as increases. Therefore, will leave the basis in this pivot.
This is called the Ratio Test because we can compute these numbers as
If a coefficient on was positive, we would ignore that constraint as increasing would never violate the corresponding inequality.
The ratio test can also be thought of as changing the solution via a vector. In particular, we are at the basic feasible solution . Now, as we increase , we change the solution as
We will see these numbers appear as we pivot the dictionary to the new basis.
Originally, . Solve for :
Substitute into the other rows (and the objective row), isolating each basic variable on the left and all others on the right:
Hence the new basic variables are if we were to place in the dictionary as well. Typically, in a standard simplex dictionary, is displayed in its own row, but it is not counted as a “basic variable” in the same sense as the constraints. The nonbasic variables are now .
Set and (the new nonbasic variables).
Then become:
Substitute in the objective row:
Thus the new BFS after the pivot is with .
Since the objective function still has variables with positive coefficients in it, we will seek to pivot again to increase the objective.
We look at the coefficients of the nonbasic variables in the objective row,
has a coefficient (which is positive),
has a coefficient (negative).
Since this is a maximization problem, increasing a variable with a negative objective coefficient would decrease . Hence we choose , the only nonbasic variable with a positive coefficient, to enter the basis.
We hold for the moment and let increase from . Then from the above system, the three basic variables become (substituting ):
We require these to remain nonnegative:
The smallest upper bound is , which means will reach zero first when . Hence must leave the basis.
From
we isolate :
Rewriting,
This becomes the new pivot row, with on the left side as a basic variable.
Next, we substitute into the rows for to remove . (In each row, replace by .)
Substitute :
Substitute :
Updating the Objective Row : Originally
Substitute :
After the pivot, the basic variables are now , and the nonbasic variables are . Our updated equations, in a clean dictionary form (basic on the left) are:
Setting the new nonbasic variables and gives
Thus our new BFS is with objective value .
Remark. Reading the Final Dictionary From the final dictionary below, we read the solution using the same process:
Set all nonbasic variables equal to zero. Here, the nonbasic variables are and .
Evaluate the values of the basic variables and the objective .
This yields the final basic feasible solution:
Why is this optimal? This is a maximization problem, and the final dictionary expresses the objective as:
Both
and
are nonbasic and currently zero. Since increasing either would decrease the value of , we
cannot improve the objective by pivoting.
Hence, this solution is optimal.
We now summarize the whole process:
Basic Feasible Solution:
Objective Value: .
Since the objective row has a positive coefficient, it is not optimal.
Basic Feasible Solution:
Objective Value: .
Since the objective row has a positive coefficient, it is not optimal.
Basic Feasible Solution:
Objective Value: .
Since all coefficients in the objective row are non-positive, this is the
optimal solution.
Resources
You can review these calculations using the code available here in Jupyter Notebook Format.
A useful way to internalize what just happened: every vertex of the feasible region has its own dictionary, the same linear program rewritten from that vertex’s point of view. Figure 7.4 shows all five dictionaries for our example. The simplex method simply walks from dictionary to dictionary along edges of the region, and the signs of the objective-row coefficients at each vertex tell it where to go next. At both coefficients are negative, so the walk stops: no neighboring vertex is better.

Here we formally describe the simplex algorithm.
Algorithm: Simplex Method
Input. A linear program in standard form with a feasible starting basis (typically
the slack variables).
Initialization. Write the system in dictionary form (basic variables on the left,
nonbasic variables on the right) and substitute the basic variables into the objective
function.
☞ Choose the entering variable Select a nonbasic variable with a positive coefficient in the objective row. (If no coefficient is positive, the current solution is already optimal.)
✏ Determine the leaving variable For each basic variable with a positive entering-variable coefficient, compute the ratio . The basic variable with the smallest ratio reaches zero first and leaves the basis.
❒ Pivot Rewrite the leaving variable’s equation so it is expressed in terms of the entering variable, then substitute this expression into all other equations and the objective function.
✔ Repeat until optimal Repeat the three steps above until every objective-row coefficient of a nonbasic variable is non-positive. The current basic solution is then optimal.
We dive a little deeper into what the ratio test is here:
The Ratio Test (Formal Definition)
The Ratio Test is used to determine which basic variable should leave the basis when a nonbasic variable enters. It ensures that we maintain feasibility by preventing any basic variables from becoming negative.
Given a pivot column corresponding to the entering variable (say, ), the Ratio Test is defined as follows:
Identify all constraints of the form:
where is the right-hand side value, and is the coefficient of the entering variable in row .
Compute the ratio for all constraints where :
The leaving variable corresponds to the row that gives the smallest positive ratio. This ensures that the increase in does not cause any basic variable to become negative.
Special Cases:
If all , then the problem is unbounded, meaning the objective function can be increased indefinitely.
If multiple rows attain the same minimum ratio, a tie-breaking rule is needed (e.g., Bland’s Rule to avoid cycling).
The Ratio Test guarantees that we always select the proper constraint to maintain feasibility while pivoting towards an improved solution.
Learning Checkpoint 7.4.1
When applying the simplex method, why might choosing the wrong leaving variable during the ratio test lead you to an infeasible basic solution?
Hint: Think about what the ratio test is meant to guarantee for the nonnegativity of variables after the pivot.
We will see another example of this, and then modify it to handle LPs that don’t have a simple initial basic feasible solution.
Here is the same computation from Section 7.3 again, this time in compact form, so you can see the whole run at a glance now that each step has a name. Each computation is colour-coded to match the algorithm card above: entering (green), ratio test / leaving (orange), pivot (blue), and optimal (purple).
Initial dictionary (basis ; nonbasic ):
Iteration 1.
☞ Entering. Both and have positive coefficients in . By steepest ascent we increase the one with the larger coefficient, (coefficient ), so enters.
✏ Ratio test. As increases (with ), each basic variable stays nonnegative only up to its ratio:
The smallest ratio is , attained by , so leaves.
❒ Pivot. Solve the row for : . Substituting into the objective and the other rows gives
Iteration 2.
☞ Entering. Only has a positive objective coefficient (), so enters.
✏ Ratio test. As increases (with ):
The smallest ratio is , attained by , so leaves.
❒ Pivot. Solve the row for : . Substituting gives
✔ Optimal. Every nonbasic objective coefficient is , so no further improvement is possible: .
In the example worked out in the prior section, we used the steepest ascent pivot rule, which means that we always used the variable in the objective with the largest positive coefficient to enter the basis. However, we could make other choices instead. The choice of how to pivot is left a little ambiguous in the simplex method and many different pivot rules have been proposed. See Exercise 7.25 to see how the simplex method plays out when pivoting in a different direction first.
In fact, in the figure below, we show the simplex dictionary at every single vertex. You can see that from any vertex, you can pivot along an edge of the feasible region to another vertex.
Remark. Reduced Costsdef:reduced-cost The coefficients of the nonbasic variables in the objective row are their reduced costs:
These values indicate how much the objective would change per unit increase in the corresponding variable, assuming all others are held fixed and feasibility is maintained.
Because this is a maximization problem, a negative reduced cost implies that increasing the variable would decrease the objective.
Optimality Condition: A basic feasible solution is optimal if and only if all reduced costs of nonbasic variables satisfy:
In this dictionary:
Therefore, the current solution is optimal.
Definition 7.14: Reduced Costs in an Arbitrary Dictionary
Let a linear program in standard form be given by
and let be a basis of linearly independent columns of . The corresponding dictionary expresses the basic and objective variables in terms of the nonbasic variables :
Here:
are the basic variables,
for are the nonbasic variables,
is the current value of the objective,
is the reduced cost of variable , and
is the value of basic variable when for all .
Try it out visually!
Two-Phase Simplex: watch artificial variables enter, Phase 1 drive them out, and the handoff to Phase 2.
Learning Outcomes
Address case where initial basis is infeasible
Modify the simplex algorithm using the Big-M method to find a feasible starting basis
Introduce artificial variables to rows that violate initial feasibility
Add large penalty (Big-M) to the objective on these artificial variables
Run Simplex and pivot until can remove artificial variables
Drop the auxiliary variables and proceed with the simplex algorithm
Every worked example so far started from the origin , where the slack variables handed us an obvious basic feasible solution. That convenience disappears the moment the problem has a “” constraint: at the origin the corresponding slack is negative, so the natural starting dictionary is infeasible and there is no basis from which to launch the simplex method. This section shows how to manufacture a feasible starting basis with an artificial variable penalized by a large constant (the Big-M method), and how the same device reveals when a problem has no feasible solution at all.
Consider
The first constraint points the wrong way for an easy start, so the origin is infeasible and we cannot simply read off a starting basis.
Geometrically, the origin lies outside the feasible region, so it cannot serve as a starting vertex:
Step 1 — Put every constraint in “” form. Multiplying the constraint by turns it into a constraint:
Step 2 — Form the slack dictionary and spot the infeasibility. Introducing slack variables gives
At this gives , so the dictionary is infeasible and the usual simplex start is unavailable.
Step 3 — Introduce an artificial variable. Add a nonnegative artificial variable to the offending equation and penalize it heavily in the objective (here ), so the simplex method is driven to push it back to zero:
Step 4 — Pivot to a feasible basis. Swapping into the basis in place of makes every right-hand side nonnegative at , giving a genuine starting point:
With a feasible basis in hand, we run the simplex method as usual. Letting enter drives the artificial variable back out of the basis:
The structure of this feasible dictionary is worth pausing on.
Remark. Artificial Variable Can Be Removed: Feasible Start for Phase II This is the second artificial dictionary from Phase I of the two-phase simplex method. Our goal was to eliminate the artificial variable while finding a feasible solution to the original problem.
Consider this dictionary:
The artificial variable appears in the system, but it is not basic.
Because is a nonbasic variable and its value is currently zero, it can be removed from the dictionary without violating feasibility.
All basic variables () have nonnegative values when , and all coefficients of can simply be deleted.
Conclusion: We now have a basic feasible solution to the original problem (with no artificial variables present), so we can begin Phase II of the simplex method using this dictionary as the starting point.
Learning Checkpoint 7.5.1
Why can the artificial variable be removed from this system?
Now is nonbasic, so the basis is feasible for the original problem. We may discard the artificial variable and continue from the feasible dictionary
Algorithm: Big-M Method
Input. A linear program in standard form (maximize), possibly with an infeasible initial basic solution.
☞ Add artificial variables For each constraint with a negative right-hand side, multiply the constraint by so the RHS becomes positive. For each constraint without an obvious feasible basic variable, add an artificial variable .
✏ Penalize the artificials Add a penalty term (with a very large constant) for each artificial variable to the objective. Form the initial dictionary (including slack/surplus and artificial variables) using this modified objective, with the artificials in the starting basis.
❒ Drive the artificials out While an artificial variable is in the basis (or the basic solution is infeasible), perform a simplex pivot, using the modified objective, that moves at least one artificial variable out of the basis.
☞ Restore and continue Once all artificial variables are zero, remove their columns and continue the standard simplex iterations using the original objective function.
✔ Output The optimal solution to the original problem, or a declaration of infeasibility if any artificial variable remains positive.
Consider the linear program
The first two constraints demand that be simultaneously at least and at most , so we should expect trouble. Rewriting the constraint as and adding a slack gives , which is negative at the origin. Exactly as before, we add an artificial variable (penalty ) and pivot it into the basis to obtain a feasible starting dictionary:
Pivot: enters, leaves.
Pivot: enters, leaves.
Every objective-row coefficient is now nonpositive, so this dictionary is optimal for the penalized (Big-M) problem, yet the artificial variable is still basic.
In the final dictionary, the artificial variable appears in the equation
When the nonbasic variables and are set to zero (which is typical in a basic solution), we find
Because in the optimal dictionary, this indicates that the original linear program has no feasible solution. The presence of a positive artificial variable in the final optimal dictionary is the standard signal in the Big-M method that the original problem is infeasible.
In summary, the contradictory constraints (requiring to be both at least 22 and at most 16) force the artificial variable to remain positive. Thus, the Big-M method confirms that the problem is infeasible.
Remark. Final Artificial Dictionary Indicates Infeasibility This is the final dictionary at the end of Phase I of the two-phase simplex method, where the goal was to eliminate the artificial variable and reach a feasible solution to the original problem.
To interpret this:
The artificial variable is still in the basis.
Its value is expressed as , and since all variables on the right-hand side are constrained to be nonnegative, we have .
Therefore, we cannot make , which is required to reach feasibility in Phase I.
Thus, there is no feasible solution to the original problem.
Conclusion: The original linear program is infeasible.
Theorem 7.15: Infeasibility Detection via the Big-M Method
Consider the linear programming problem
After converting inequalities to equalities by introducing slack, surplus, and, if needed, artificial variables, the system takes the form
where is a submatrix of the identity matrix, with each column corresponding to an artificial variable introduced to enforce equality in a constraint that initially lacked a basic variable with a nonnegative right-hand side. The Big-M formulation is then given by
If, in any optimal solution of the Big-M problem, there exists an artificial variable for some , then the original linear programming problem is infeasible.
Proof. Assume that an optimal solution of the Big-M problem satisfies for some .
Suppose, for contradiction, that the original linear programming problem is feasible. Then there exists some such that . In the reformulation process, if a constraint lacked a basic variable with a nonnegative right-hand side, an artificial variable was introduced, rewriting the constraint as
For any feasible of the original problem, we can set for all artificial variables, and the equality constraints will still be satisfied.
Thus, the solution is feasible for the Big-M formulation, and its objective value is exactly . On the other hand, the optimal solution yields an objective value of
Since is chosen to be a very large positive constant, any positive contribution from imposes a severe penalty. Consequently, the objective value of would be strictly greater than that of provided that is sufficiently large.
This contradiction implies that no feasible solution exists for the original problem. In other words, the assumption that the original problem is feasible is false.
Hence, if in the optimal solution of the Big-M problem any artificial variable remains positive, the original linear programming problem must be infeasible. □
When several constraints point the “wrong” way, we simply add one artificial variable per offending constraint. Consider
Two constraints are of “” type, so the origin violates both. Flipping them to and and adding slacks gives and , both negative at the origin. We introduce two artificial variables (each penalized by ) and pivot them into the basis, producing a feasible starting dictionary whose objective row carries the Big-M penalty:
The large penalties make and attractive to increase, and successive pivots drive both artificial variables out of the basis. Once the basis is feasible for the original problem; we drop the artificials and continue on the true objective until every reduced cost is nonpositive:
Reading the optimal dictionary gives , , and , with the first and third constraints slack (, ) and the second constraint tight ().
Definition 7.16: Degeneracy
A basic feasible solution (BFS) in the Simplex Method is said to be degenerate if one or more of its basic variables take a value of zero. Mathematically, a BFS corresponding to a basis is degenerate if there exists at least one basic variable such that .
Remark. Degenerate Dictionary The dictionary below represents a feasible solution, but one of the basic variables is equal to zero. This situation is called degeneracy.
What is degeneracy? A dictionary is called degenerate if any basic variable is equal to zero. This is important because:
It can cause the simplex method to perform a pivot without changing the objective value.
It can potentially lead to cycling, revisiting the same basic solution more than once.
In this dictionary:
The basic variables are .
When we set the nonbasic variables , , we find:
Since and it is in the basis, this is a degenerate basic feasible solution.
In this case, the basic feasible solution is (basic variables) and (non-basic variables) .
Degeneracy can lead to cases where pivoting in the Simplex Method does not change the basic feasible solution. When a pivot is performed, the entering variable is increased until one of the current basic variables reaches zero, at which point that variable leaves the basis. However, if multiple constraints yield the same minimum ratio in the ratio test, then a tie-breaking rule must be applied. If the variable that leaves the basis was already zero, the BFS remains unchanged.
Notice in the prior example, we can try to let enter the basis. What happens? By the ratio test, we see that leaves the basis. This results in the following new dictionary:
Remark. Degenerate Pivot: No Change in BFS After pivoting into the basis and out, we arrive at the dictionary below.
Here is what happened:
Before the pivot, the basic variables were , and the nonbasic variables were .
After the pivot, enters and leaves. The new basic variables are .
However, when we plug in the nonbasic values , we get:
This is identical to the previous basic feasible solution.
Conclusion: This is a case of a degenerate pivot: we performed a pivot step, but the resulting basic feasible solution did not change. The simplex algorithm moved to a new dictionary (i.e., a new basis), but the point in solution space stayed the same.
But! The basic feasible solution is the same!!!
Fortunately, the next pivot leads to a new solution.
However, this phenomenon can cause the algorithm to visit the same BFS multiple times, potentially leading to cycling.
See https://gilp.henryrobbins.com/en/latest/examples/3d/SQUARE_PYRAMID_3D_LP.html for a highly degenerate case where the first two pivots do not change the solution.
In the Simplex Method, a pivot operation normally improves the objective function by moving from one basic feasible solution (BFS) to another. However, in rare cases, the method can revisit the same BFS multiple times without progress. This phenomenon is called cycling.
Cycling occurs due to:
Degeneracy: when one or more basic variables are zero.
Unlucky pivot rules: which cause the algorithm to rotate through different bases that correspond to the same BFS.
The following example demonstrates cycling. The entering variable is chosen by the largest-coefficient rule, and ties in the minimum ratio test are broken naively, by taking the tied row whose basic variable is listed first. This combination cycles on the example below. Anti-cycling pivot rules, such as the lexicographic rule or Bland’s rule (described later in this section), prevent this behavior.
Cycling occurs when the Simplex Method revisits the same set of basic variables repeatedly without making progress in improving the objective function. This happens when degeneracy is present and the choice of entering and leaving variables results in looping between a set of degenerate BFSs.
The following example demonstrates cycling in the Simplex Method. It is a rescaled version of the classic cycling example constructed by E. M. L. Beale (1955), the first published instance of an LP on which the simplex method cycles; only the units of two variables have been changed, which preserves the cycle.
Initial Dictionary
Pivot: enters, leaves.
Pivot: enters, leaves.
Pivot: enters, leaves.
Pivot: enters, leaves.
Pivot: enters, leaves.
Pivot: enters, leaves.
This last dictionary is identical to the initial one: after six pivots the method has returned to its starting basis with the objective still at . The simplex method is cycling, and without an anti-cycling safeguard it will loop forever.
Bland’s Rule is a tie-breaking strategy used to prevent cycling in the Simplex Method. The rule ensures that:
By enforcing this lexicographic ordering, the method guarantees progress and prevents the algorithm from revisiting the same basis indefinitely.
Theorem 7.17: Bland’s Rule Prevents Cycling
If Bland’s Rule is used to select the entering and leaving variables in the Simplex Method, then the algorithm will terminate in a finite number of steps, either by reaching an optimal solution or by detecting an unbounded problem.
Proof sketch. Suppose, for contradiction, that the method cycles: a sequence of degenerate pivots returns to a basis visited before. During a cycle the basic feasible solution and the objective value never change, and some set of variables enters and leaves the basis over and over. Consider the largest-indexed variable that takes part in the cycle. Comparing the dictionary at a step where enters with the dictionary at a step where leaves, a sign analysis of the two objective rows shows that at one of these steps some variable with index smaller than was also eligible, so Bland’s rule could not have selected there, a contradiction. Hence no basis repeats; since there are finitely many bases, the algorithm terminates. The full argument is standard and can be found, for example, in Chvátal’s Linear Programming. □
From the example above, following the same sequence, we arrive at this dictionary.
Pivot: enters, leaves. Bland’s rule: choose the lowest-index eligible entering and leaving variables
Bland’s rule breaks the tie differently from before: the method moves to a genuinely new basis and the objective strictly increases to . The cycle is broken, and the simplex method now makes progress toward optimality.
Example 7.18: Unbounded Linear Program
Consider the linear program:
We convert the inequalities into equalities using slack variables and :
Initial dictionary.
Pivot: enters, leaves. ratio test: , so leaves
Pivot: enters, leaves. only limits
Now is eligible to enter (its objective coefficient is positive), but its column is entirely nonnegative: in and the coefficients of are and . Increasing raises both basic variables and never drives one to zero, so the ratio test finds no limiting row. The objective grows without bound, and the linear program is unbounded.
Conclusion: This linear program is unbounded. Once enters the basis, there is no constraint limiting how large it can grow while maintaining feasibility. Therefore, the objective function can increase without bound.
Pioneer Spotlight: George Dantzig
George Dantzig, known for spearheading linear programming with the simplex algorithm, was born in Portland, Oregon on November 8, 1914.1 George received his Bachelor of Arts in Mathematics and Physics from the University of Maryland, College Park. After marrying his wife, Anne Shmuner, he completed his Master of Arts in Mathematics at the University of Michigan in 1938. Before graduating with his Master’s degree, he began working at the United States Bureau of Labor Statistics as a junior statistician. George took interest in statistics through the work of Jerzy Neyman, which led him to earn a Ph.D. in Statistics with Neyman’s guidance from the University of California, Berkeley in 1946. Before his dissertation, he began working with the Army Air Force Combat Analysis Branch of Statistical Control at the Pentagon, then transferred to the Department of the Air Force as a mathematical advisor. After his work at the Pentagon, he became a professor in operations research at the University of California, Berkeley, and Stanford. He went on to receive the National Medal of Science in 1975. He was also a member of the National Academy of Engineering, the National Academy of Sciences, and the American Association of Arts and Sciences.2
While in school at the University of California, Berkeley, George became widely known for solving two of the “unsolved” statistics problems, which he mistakenly thought were homework. In 1947, Dantzig proposed the simplex algorithm, which started the field of linear programming.3 Geometrically, the simplex method consists of traveling along the edges of a polyhedron from vertex to vertex. The feasible region of a linear program is always convex, and if the program has an optimal solution and its feasible region has a vertex, then some optimal solution occurs at a vertex. The linear program should be in the following standard form:
The corresponding vertices of the feasible region are the basic feasible solutions. If a system is nondegenerate, the process of simplex pivoting can occur, where the previous solution is used to pivot towards a better feasible basis.
After Dantzig’s development of the simplex algorithm, he presented a talk geared toward the application of his linear programming model in the digital world, including games and computers. His algorithm was implemented in the animal feed industry and computing machines for the Air Force. It was also used to solve Stigler’s “diet problem,” a simple question with modern technology, but a long computation process in 1947. Dantzig’s procedure has been utilized in countless industries, such as communications, railroads, petroleum, airlines, and the economy. His utilization of linear algebra theory and the creation of pivoting will continue to be used when solving complex linear problems.
Dantzig also studied network flow problems, which led to the duality theorem in the 1950s. The dual theorem utilizes the costs as integers to create a pair that highlights integer basic solutions, which was used in the application of the “fleet assignment model.” With a great understanding of real-world problems, Dantzig developed the recourse stochastic program, which accounted for uncertain constraints and utilized statistical tests to determine the likelihood of an optimal solution. Dantzig was responsible for the solution to countless military problems through his development of linear programming in the late-1940s.
This spotlight was contributed by Irma Adams
Exercise 7.19: Standard form and the first dictionary
Consider the linear program
[§7.3, Initial Dictionary; §7.1]
Exercise 7.20: Convert to Standard Form
Convert the following linear program to standard form:
[§7.1, Example: Complete Conversion to Standard Form]
Exercise 7.21: Convert to Standard Form
Convert the following linear program to standard form:
[§7.1, Example: Complete Conversion to Standard Form]
Exercise 7.22: Convert to Standard Form
Convert the following linear program to standard form:
[§7.1, Example: Complete Conversion to Standard Form]
Exercise 7.23: Convert to Standard Form
Convert the following linear program to standard form:
[§7.1, Example: Complete Conversion to Standard Form]
Exercise 7.24: Convert to Standard Form
Convert the following linear program to standard form:
[§7.1, Example: Complete Conversion to Standard Form]
Exercise 7.25: Pivoting in a different direction
We consider the example from Section 7.3. In that example, we pivoted first on the variable. This choice of pivot called the steepest ascent rule since we chose the variable in the objective with the largest coefficient. However, we can consider pivoting on any variable with a positive coefficient in the objective. We will now pivot first on the variable.
Starting Point
Exercise 7.26: Simplex Method Practice
Solve the following linear programming problem using the simplex method:
Exercise 7.27: Simplex Method Practice
Solve the following linear programming problem using the simplex method:
Exercise 7.28: Simplex Method Practice
Solve the following linear programming problem using the simplex method:
Exercise 7.29: Simplex Method Practice
Solve the following linear programming problem using the simplex method:
Exercise 7.30: Simplex Method Practice
Solve the following linear programming problem using the simplex method:
[§7.5]
Exercise 7.31: Simplex Method Practice
Solve the following linear programming problem using the simplex method:
[§7.5]
Exercise 7.32: Dictionary Optimality
Conditions in the dictionary. The following is a dictionary of a maximization problem. State conditions (i.e., the range of values) on that are required to make the following true. Note: This does not require any simplex pivots.
Exercise 7.33: Basic Feasible Solutions
Consider the following linear programming feasible region in 2 variables that is depicted in the plot below.
Here is a graph of the feasible region:
The variables in the augmented linear program are , where and are the surplus variables of the two constraints and and are the slack variables of the two constraints, in the order listed (matching the labels in the figure). In the context of the simplex method, answer the following questions:
(a) At the basic feasible solution , which variables are non-basic and which variables are basic?
(b) If we pivot from the basic feasible solution at to the basic feasible solution at ,
Which variable enters the basis?
Which variable leaves the basis?
Exercise 7.34: What the ratio test protects
In the second dictionary of the running example of Section 7.3,
the entering variable is , and the ratio test selects (ratio ) to leave.
[§7.4, Learning Checkpoint 7.4.1]
Exercise 7.35: A tie in the ratio test forces degeneracy
Consider the linear program
Solution
(Exercise 7.23)
1. Convert the minimization problem to a maximization problem by negating the objective function:
2. Convert the constraint into an equality by introducing a surplus variable :
3. Convert the constraint into an equality by introducing a slack variable :
4. Since is unrestricted, replace it with , where .
Final Standard Form:
Solution
(Exercise 7.24)
1. Convert the minimization problem to a maximization problem by negating the objective function:
2. Convert the constraint into an equality by introducing a slack variable :
3. Since is unrestricted, replace it with , where .
Final Standard Form:
Solution
[Solution for Exercise 7.25] We will have to do 3 pivots!
We begin with the original linear program:
First Pivot: Enters the Basis
Let increase first. The ratio test gives for , for , and for . The smallest ratio is , so leaves the basis. Rewriting the equation in terms of and substituting into the other equations and the objective, we obtain:
Second Pivot: Enters the Basis
Now is the only variable with a positive objective coefficient, so enters. The ratio test gives for , for , and for , so leaves. After rewriting the equation in terms of and substituting into the remaining equations and the objective function, the dictionary becomes:
Third Pivot: Enters the Basis
The coefficient of in the objective is positive, so enters. In the row appears with a positive coefficient, so that row imposes no limit; the ratio test gives for and for , so leaves. The new dictionary is
This is optimal!
Solution
(Exercise 7.26) Add slacks to obtain the initial dictionary
First pivot: enters (coefficient ). Ratio test: and , so leaves. Solving the equation for and substituting gives
Second pivot: enters. Ratio test: and , so leaves. The new dictionary is
Both objective coefficients are negative, so this dictionary is optimal: with .
Solution
(Exercise 7.27) The initial dictionary is
First pivot: enters (coefficient ). Ratio test: and , so leaves. Substituting gives
Second pivot: enters. Ratio test: and , so leaves, and the dictionary becomes
This dictionary is optimal: with .
Solution
(Exercise 7.32) The basic solution reads off the constant terms: , , , with .
Solution
(Exercise 7.35) (a) The initial dictionary is
With entering (and ), the ratio test gives for and for : a tie at .
(b) Let leave. Solving the row for gives , and substituting,
The basic variable has value , so the dictionary is degenerate. (It is also optimal: both reduced costs are negative, and the solution is with .)
(c) Let leave instead. Solving the row for gives , and substituting,
Again a basic variable () equals zero, so this dictionary is degenerate as well. The reduced cost of is exactly : increasing does not change , which signals that the optimum is not unique along that direction of the boundary (any point of the edge from toward the constraint with held tight gives only at itself here, since increasing is blocked at once by ; the zero reduced cost still flags the possibility of alternative optimal bases).
(d) If two rows tie at the minimum ratio, the entering variable stops at a value where both corresponding basic variables hit zero simultaneously. Only one of them leaves the basis; the other remains basic at value zero, so the new dictionary necessarily has a basic variable equal to zero, which is the definition of degeneracy. Any linear program in which two constraint boundaries pass through the same point of the entering edge works as a construction, for example subject to , , : entering gives ratios and , a tie.