Skip to content
シンプレックス法計算機 シンプレックス法計算機
← ブログに戻る
How to Calculate Zj and Cj-Zj in the Simplex Method (With Example)

How to Calculate Zj and Cj-Zj in the Simplex Method (With Example)

公開日 June 27, 2026 · 著者 Simplex Method Calculator Editorial Team

The Zj and Cj − Zj rows are the decision-making part of every simplex tableau. They tell you which variable should enter the solution, and they tell you when to stop. Most simplex mistakes come from calculating them wrongly, so this guide explains the formula, the meaning, and then works through a full example column by column.

To check your own numbers, enter the problem in the simplex method tableau calculator, which shows both rows in every tableau.

The Formula for Zj

For each column j of the tableau:

Zj = Cb1 × a1j + Cb2 × a2j + … + Cbm × amj

In words: multiply each entry in the column by the Cb value of its row, then add the products.

  • Cb is the objective coefficient of the basic variable in that row.
  • aij is the number in row i, column j.

The same formula applied to the right-hand-side (RHS) column gives the current value of the objective, Z.

The Formula for Cj − Zj

Cj − Zj = (objective coefficient of the column’s variable) − Zj

Cj is simply the number in front of that variable in the objective function: 0 for slack and surplus variables, and −M or +M for artificial variables in the Big M method.

What the Numbers Mean

  • Zj is the amount of objective value you give up when one unit of variable j enters. Bringing it in forces the current basic variables to change, and Zj adds up what those changes cost.
  • Cj is what you gain from one unit of variable j.
  • Cj − Zj is the net effect on the objective of bringing in one unit. It is also called the reduced cost or the relative profit.

Rules for Using Cj − Zj

Problem typeEntering variableOptimal when
MaximizationLargest positive Cj − ZjEvery Cj − Zj ≤ 0
Minimization (solved directly)Most negative Cj − ZjEvery Cj − Zj ≥ 0

For basic variables, Cj − Zj is always 0. If you get a non-zero value under a basic variable, there is an arithmetic error somewhere in the tableau.

Worked Example

Maximize Z = 12x1 + 16x2 subject to 10x1 + 20x2 ≤ 120, 8x1 + 8x2 ≤ 80, x1, x2 ≥ 0.

The Initial Tableau

Both basic variables are slacks, so both Cb values are 0. Every product in the Zj formula is zero:

BasisCbx1x2s1s2RHS
s10102010120
s20880180
Zj00000
Cj121600
Cj − Zj121600

This is why, in the first tableau, Cj − Zj is simply the list of objective coefficients, and the variable with the largest coefficient enters. Here x2 enters (16), and the ratio test (120/20 = 6 against 80/8 = 10) removes s1.

The Second Tableau: Calculating Zj Column by Column

After the pivot, x2 is basic in the first row with Cb = 16, and s2 is basic in the second row with Cb = 0:

BasisCbx1x2s1s2RHS
x2161/211/2006
s2040−2/5132

Now apply the formula to each column:

  • x1: 16 × 1/2 + 0 × 4 = 8
  • x2: 16 × 1 + 0 × 0 = 16
  • s1: 16 × 1/20 + 0 × (−2/5) = 4/5
  • s2: 16 × 0 + 0 × 1 = 0
  • RHS: 16 × 6 + 0 × 32 = 96 (the current Z)

Then subtract each from Cj:

  • x1: 12 − 8 = 4
  • x2: 16 − 16 = 0 (basic variable, as expected)
  • s1: 0 − 4/5 = −4/5
  • s2: 0 − 0 = 0 (basic variable)
x1x2s1s2RHS
Zj8164/5096
Cj − Zj40−4/50

x1 has a positive Cj − Zj of 4, so the solution is not optimal and x1 enters next.

Interpretation: producing one unit of x1 now earns 12, but because the machine hours are already full, it forces x2 down by 1/2 unit, which costs 16 × 1/2 = 8. The net gain is 12 − 8 = 4 per unit.

The Final Tableau

After the second pivot (x1 enters, s2 leaves), the basis is x2 with Cb = 16 and x1 with Cb = 12:

BasisCbx1x2s1s2RHS
x216011/10−1/82
x11210−1/101/48
  • Zj under s1: 16 × 1/10 + 12 × (−1/10) = 16/10 − 12/10 = 2/5
  • Zj under s2: 16 × (−1/8) + 12 × 1/4 = −2 + 3 = 1
  • Zj under RHS: 16 × 2 + 12 × 8 = 32 + 96 = 128

So Cj − Zj is −2/5 for s1 and −1 for s2, and 0 for x1 and x2. Everything is ≤ 0, so the tableau is optimal with x1 = 8, x2 = 2 and Z = 128. The full solution is in how to solve an LPP by the simplex method.

Zj Under Slack Columns = Shadow Prices

In the optimal tableau, the Zj values under the slack columns (2/5 and 1 here) are the shadow prices of the constraints. One extra machine hour would raise the maximum profit by 2/5, one extra labour hour by 1. They are also the optimal values of the dual problem, explained in duality in linear programming. For how to interpret them and the range where they stay valid, see what is a shadow price.

Zj With Big M

When artificial variables have Cb = −M (maximization) or +M (minimization), Zj entries contain M. Calculate them the same way and keep the number part and the M part separate. For example, if Cb = −M for a row with entry 4, its contribution is −4M. When comparing Cj − Zj values, compare the M parts first. The Big M method guide has a full example.

Common Mistakes

  • Using Cj instead of Cb in the sum. Zj uses the Cb values of the rows, not the column’s own coefficient.
  • Not updating Cb after a pivot. The row that changed now belongs to the entering variable, with its objective coefficient.
  • Sign errors with negative entries. 16 × (−1/8) is −2, not 2.
  • Calculating Cj − Zj as Zj − Cj. Some textbooks use the bottom row Zj − Cj instead. Then the signs are reversed: maximization picks the most negative value and stops when all are ≥ 0. Stick to one convention throughout a problem.

Check Your Work

Enter 12x1 + 16x2 with the two constraints in the step-by-step simplex calculator to see the same Zj and Cj − Zj rows in each tableau.