Solve the primal solution: ================================= min z = -3x_1 + x_2 + x_3 + 0x_4 + 0x_5 subjec to (AA)x = bb x nonnegative ================================== By hand calculation, one need to use artifial variables and the two phase method. c = [0 0 0 0 0 1 1] A =[]; b=[]; AA = [1 -2 1 1 0 0 0 -4 1 2 0 -1 1 0 -2 0 1 0 0 0 1]; bb = [11 3 1]'; LB=[0 0 0 0 0 0 0]; UB = []; [x,fval] = linprog(c,A,b,AA,bb,LB,UB) Ans: x = [0 1 1 12 0 0 0]', z = 0. ================================================== Then we use the second, third, fourth column of A to form B = [-2 1 1 1 2 0 0 1 0]; AA = B^(-1)*AA; AA = AA([1,2,3],[1,2,3,4,5]); bb = B^(-1)*bb; c = [-3, 1, 1, 0, 0]; LB =[0 0 0 0 0] UB = [] [x,fval] = linprog(c,A,b,AA,bb,LB,UB) Ans: x = [4,1,9,0,0]', z = -2. ======================================================= In Matlab, we can directly use: c = [-3 1 1 0 0]; A =[]; b=[]; AA = [1 -2 1 1 0 -4 1 2 0 -1 -2 0 1 0 0]; bb = [11 3 1]'; LB=[0 0 0 0 0]; UB = []; [x,fval] = linprog(c,A,b,AA,bb,LB,UB) Ans: x = [4,1,9,0,0]', z = -2 ============================================================ Now, we use the first, second, third column to form B = [1 -2 1 -4 1 2 -2 0 1]; B^(-1)*[AA b], y = [-3,1,1]*B^(-1), c - c_B*AA ans = 1.0000 0.0000 0 0.3333 -0.6667 0 1.0000 0 0 -1.0000 0 0.0000 1.0000 0.6667 -1.3333 y = -0.3333 0.3333 0.6667 ans = 0.0000 -0.0000 0 0.3333 0.3333 ========================================================= Set y^t = c_B B^(-1). Then c^t - y^tA is nonnegative. So, c - A^t y is nonnegative, i.e., y is dual feasible. One can check y^t b = c_B B^(-1)b = z = the primal optimal. =============================================================