Dual variable 2026-10-14
A dual variable is a multiplier associated with a primal constraint in a dual linear program. In a minimization linear program with equality constraints and nonnegative primal variables, the Lagrangian yields the dual objective and inequalities ; the equality-constraint multipliers are unrestricted in sign. For a transportation problem, row and column dual variables give potentials satisfying . Complementary slackness makes occupied routes attain equality.
Farkas certificate for linear inequalities Created 2026-10-07 Updated 2026-10-14
Let and . For unrestricted , the system of linear inequalities has no feasible point if and only if there is a vector withThe entries are nonnegative Lagrange multipliers for the rows. Multiplying inequalities by them preserves their direction; the condition cancels every variable, leaving the contradictionThis is a Farkas' lemma alternative for non-strict inequalities; no strict-feasibility assumption is needed. See Boyd and Vandenberghe, Convex Optimization (2004), §5.8.3, pp. 261–262.
Three individually possible requirements, jointly impossible. Suppose two unrestricted real coordinates , drawn as in the diagram, must satisfyWrite every row in the same direction:Then and . The nonnegative weighted sum, with Lagrange multipliers , is visiblyEach individual requirement defines a half-space in the plane. Even every pair has a feasible point: satisfies the first two, the first and third, and the second and third. Their common intersection is empty, because the first two force , while the third demands at most .
Why cancellation is necessary for unrestricted variables. A nonzero linear functional can be made arbitrarily positive or negative by varying unrestricted , so alone would not yield a contradiction. Equality is essential here. If is also imposed, the sufficient certificate becomes , , , because then . This is the sign convention used in robust infeasibility under uniform constraint relaxation. One can instead append the rows and use the equality certificate on the enlarged system. Reversing all constraints to reverses the scalar sign to , as in the normalized integer Farkas infeasibility gap.
Checking a solver's infeasibility claim. A returned Farkas certificate for linear inequalities gives a short verification procedure: compute and , and check the three displayed conditions against the original constraints. Any positive multiple is another certificate; division by normalizes to . With rational numbers as data and certificate, the tests can be exact. With floating-point arithmetic, a small residual is a diagnostic rather than an exact cancellation: unrestricted can amplify a nonzero residual without bound. A rigorous certificate therefore needs exact cancellation or justified error bounds and additional bounds on the variables. The strict negative scalar is the margin of contradiction.
The same weighted sums give dual bounds. For the linear program maximizing over unrestricted with , any satisfying givesfor every feasible point. Minimizing over these multipliers is the dual linear program; the bound itself is weak duality. For example, maximize subject to , , . The multipliers give the upper bound , attained at . The infeasibility example above uses the same row directions, but lower bounds of on both coordinates. Its multipliers cancel the objective function as well as the variables: with would bound zero by a negative number. Thus impossibility and linear programming optimality certificates use the same arithmetic. See Boyd and Vandenberghe, Convex Optimization slides, §§5.32–5.35 for infeasibility as a dual alternative.
Why every inconsistent system has such a certificate. Introduce a slack variable vector and write . Split the unrestricted vector as with . Applying Farkas' lemma to the column matrix gives , , and . The first two conditions together are exactly . This reduction explains both the equality and the nonnegative row multipliers.
Homogeneous self-dual embedding of a linear program Created 2026-10-14 Updated 2026-10-25
For a linear program and its dual linear program, write , , , and . Introduce , , and a free multiplier satisfyingThe point , , is strictly positive in all constrained coordinates. Multiplying the first three equations by respectively and adding gives the displayed identity. Minimizing has value zero: primal-dual optimal solutions or certificates from Farkas' lemma give zero- solutions after selecting positive and scaling. At , gives an optimal primal-dual pair by division by , while gives a primal infeasibility or dual infeasibility certificate. A point with is not decisive; choosing a relative interior point of the optimal face of a linear program avoids that degeneracy because the face contains a point with .
Past exam of the computer science course of the University of Oxford 2018 Algorithms 3 c Solution 2026-10-31
Remove the integer requirements from the previous formulation to obtain its linear programming relaxation. Give each edge constraint a nonnegative dual variable , and each bound for a nonnegative dual variable . Since all right-hand sides are one, the dual linear program isAn integer feasible point selects a multiset of edges touching every nonisolated vertex, together with at least one singleton for each isolated vertex. Repeated edges or singleton choices can be discarded without losing coverage, so an optimum has a genuine edge cover of the nonisolated part and one singleton per isolated vertex. If has no isolated vertices, this is exactly an edge cover, with the objective counting selected edges including any unnecessary multiplicities. The isolated-singleton extension is necessary because a graph with an isolated vertex admits no ordinary edge cover.
This interpretation concerns integer feasible dual solutions. The linear programming relaxation can have fractional optima, so its value need not equal the integer independent set optimum. For example, the triangle has relaxed independent-set value , whereas its maximum independent set has size and its minimum edge cover has size .
Past exam of the computer science course of the University of Oxford 2018 Algorithms 3 d Solution 2026-10-31
Regard the two kinds of agents as the two sides of a complete bipartite graph, with edge weight . Pairing everyone is a perfect matching, and its maximum total weight is . Consider the capacitated linear programIt is feasible and bounded. Every optimum has all row and column sums equal to one: otherwise the equal total deficits of the two sides give a row and column both below one. Increasing by the smaller of their positive deficits remains feasible and increases the objective because , a contradiction.
Thus an optimum is a doubly stochastic matrix. By the Birkhoff-von Neumann theorem it is a convex combination of permutation matrices, so at least one corresponding perfect matching has weight at least its objective. Conversely every such perfect matching gives a feasible matrix. Hence . One way to justify the decomposition is to apply Hall's marriage theorem to the positive-entry support, subtract the smallest entry on a supported perfect matching, and repeat after rescaling the nonzero remainder; each subtraction removes a positive entry, so the process terminates.
The dual linear program assigns nonnegative dual variables to the row and column capacity constraints:These are exactly the permitted payments and all the pairwise acceptance conditions, so its optimal value is . It is feasible, for example by taking and . Strong duality now gives . In particular, the nonnegative payment restriction has been retained throughout; using capacity inequalities rather than equality constraints avoids introducing unrestricted prices.
For a direct weak duality check, sum over any pairing . Its revenue never exceeds the company's total offered payment. The linear programming duality and integrality argument prove that this lower bound on payments is attained.
Past exam of the computer science course of the University of Oxford 2019 Algorithms 2 b ii Solution 2026-10-25
Use the standard maximum form of a linear program convention subject to and . Split the unrestricted variables as and , with all four new variables nonnegative. The resulting linear program isIf equality-constraint standard form is preferred, add a nonnegative slack variable to each inequality.
Give the two inequalities nonnegative dual variables . The dual linear program isThe paired inequalities encode equalities for the two original unrestricted variables. Equivalently, the dual linear program has , , , and . Thus its only feasible point is , of objective function value .
Past exam of the mathematics course of the University of Cambridge 2004 iii Paper 33 1 Solution 2026-10-14
For the linear program in maximization form, a nonnegative multiplier of the resource inequalities giveswhenever . Equivalently, the Lagrangian is ; its supremum over is finite exactly when . Minimizing this bound gives the dual linear programThe displayed inequality proves weak duality directly.
For the final simplex tableau, the basic-variable order is . With interpreted as the ordinary unpriced slack variables, its constraint equations giveThe bottom row is read in the reduced-cost convention , with right side minus the basic objective value. It says the reduced costs of are . Thus optimality requires , while can increase without changing the objective until reaches zero. The complete primal optimum set is
Reconstructing a linear program from a final simplex tableau exposes a source inconsistency. The slack columns areBecause the first basic column is that of , the original constraint data areThe slack reduced costs give andConsequently the recovered homogeneous linear program isEvery point in the optimum segment has value . Since the segment contains a point with both variables positive, complementary slackness forces both dual column inequalities to be equalities. They give the unique dual optimum
The printed bottom-right entry is , but it must be for this linear objective and these constraint rows. Thus no original problem in the stated homogeneous standard form has exactly the entire printed tableau. Changing that one entry to gives the reconstructed problem above. Alternatively, if an affine objective is permitted, has the displayed optimum value and unchanged reduced costs; the corresponding affine dual objective is . Both interpretations have exactly the same primal and dual optimizer sets. The discrepancy is in the objective constant, not in the optimal segment.
Past exam of the mathematics course of the University of Cambridge 2005 ib Paper 3 20D b Solution Created 2026-09-24 Updated 2026-10-14
The dual linear program isThe negatives of the final slack payoff coefficients give . Its three dual constraints are equalities, and its objective is . Equality with the primal objective proves optimality by weak duality, independently of tableau sign conventions. It is also the complementary slackness certificate, with all primal variables and all dual variables strictly positive.
Past exam of the mathematics course of the University of Cambridge 2008 iii Paper 38 1 Solution 2026-10-14
The dual linear program is the minimization problemIndeed, for the optimization Lagrangian bounds the primal objective above on its feasible points. Its supremum over is finite precisely when , and then equals . The two labelled parts below establish the relevant weak duality and strong duality conclusions.
For the subsequent infeasibility argument, introduce nonnegative slack variables and the convex coneThis is generated by the columns of and the coordinate vectors. Here is why this finitely generated cone is closed. Any representation with a minimal number of positive coefficients uses linearly independent generators: otherwise subtract a suitable multiple of a dependence until one positive coefficient vanishes, preserving nonnegativity. For each fixed independent selection of generators, its nonnegative combinations form a closed set, because the inverse coordinate map on its span is continuous. There are finitely many selections, so their union is closed. This is the closedness of finitely generated cones used in Farkas' lemma.
When the primal linear program is infeasible, . Let be the nearest point of to , and set . The minimizing property gives for every . Taking gives . ConsequentlyIn particular and . Rescaling by the positive number produces the requested Farkas' lemma certificate:Now a feasible point of the relaxed inequalities would satisfySince , the sum of the nonnegative is positive. Thus robust infeasibility under uniform constraint relaxation givesThe ellipsoid method makes progress by reducing the volume of a containing ellipsoid. A nonempty linear polyhedron may have empty interior, so small volume alone cannot certify that the original system is infeasible. Relaxing the inequalities remedies this difficulty, but must not make an infeasible system appear feasible. The displayed positive gap proves exactly that sufficiently small relaxations preserve infeasibility. For rational input, determinant bounds give a Farkas' lemma certificate of polynomial encoding length, so a sufficiently small rational relaxation can be chosen from the input encoding length. Together with a bounding box and bounds on the volume of a relaxed feasible system, this lets the ellipsoid method distinguish infeasibility from a feasible system of very small or zero original volume in polynomial time. The certificate argument alone does not assert a polynomial precision bound for arbitrary unencoded real coefficients.
Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 38 2 a Solution Created 2026-10-03 Updated 2026-10-07
Write the primal in the form with and . Its dual linear program is with and . Indeed, nonnegative combinations of the primal inequalities give , which is weak duality. The specific dual isThe four dual inequalities correspond, in order, to the four primal variables.
Past exam of the mathematics course of the University of Cambridge 2016 ib Paper 2 9H Solution Created 2026-09-24 Updated 2026-10-06
Introduce nonnegative slack variables and start the simplex algorithm at , with slacks . The objective's largest positive entering coefficient belongs to . Its ratio test is , , , so leaves and enters.
Solve that pivot row for and substitute into the other rows and the objective :This is a feasible simplex dictionary at nonbasic variables . All their objective coefficients are negative, so no feasible increase can improve the objective. ThusThe negative reduced coefficients also prove uniqueness of this optimum.
The dual linear program, with nonnegative variables , isThe feasible choice has objective . Weak duality proves that it and the primal point are optimal. Complementary slackness also forces because the first two primal slacks are positive, and then the positive forces .
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 212 3 Solution Created 2026-10-03 Updated 2026-10-06
Use a directed bipartite graph with one vertex for each job and one for each agent. Job vertices have supply and agent vertices demand . An arc from job to agent has cost and nonnegative flow ; an upper bound may be added, but is already implied by the balances. The minimum-cost flow formulation of the assignment problem isInteger supplies and demands give an integral optimum by integrality of the transportation problem. Its positive arcs form a perfect matching, hence give one job per agent.
A network simplex algorithm basis for this connected -vertex network has tree arcs, whereas an integral assignment has only positive flows. For , at least basic tree arcs therefore carry zero flow. This unavoidable degeneracy in linear programming can cause zero-step pivots, extra bookkeeping and cycling unless an appropriate pivot rule is used. The Hungarian algorithm exploits the assignment structure directly rather than maintaining many zero-flow basic arcs.
Suppose the assignment dual potentials satisfy . For every feasible assignment ,If the selected assignment uses only arcs with , its cost equals this lower bound. Weak duality and complementary slackness certify optimality. The PDF correctly denotes the feasible assignment by ; the TeX aid mistakenly replaces it with .
The Hungarian algorithm maintains feasible assignment dual potentials and a matching in a graph of zero reduced cost edges, where . Search for an augmenting path in a matching in this equality graph. If there is none, let be the reachable jobs and the reachable agents in the alternating search from unmatched jobs. Every agent in is matched to a job in . SetReduced costs from to its complement decrease by , those from outside into increase, and the remaining ones do not change. Thus feasibility and current matching equalities are preserved, while at least one new equality edge appears. Continue until an augmenting path in a matching increases the matching size. A perfect matching in the equality graph then has the same value as the dual linear program and is optimal.
For the example, start with the row minima and . The reduced cost matrix isMatch job to agent . Searching from both unmatched jobs gives and ; the minimum cost to an agent outside is . Update to and :The new equality edge augments the matching. From unmatched job , the next alternating search reaches agent and its matched job , giving and . Now . The updated feasible assignment dual potentials and reduced costs areThe augmenting path in a matching uses job to agent , the reversed matched edge to job , then the new edge to agent . It gives the optimal assignmentThe dual linear program value is , an independent optimality certificate.
Past exam of the mathematics course of the University of Cambridge 2019 iii Paper 339 1 d Solution Created 2026-10-03 Updated 2026-10-05
Substitute the dual linear program from the previous part and optimize jointly over . The result isThe objective is linear, and the constraints are equalities or inequalities between affine functions, so this is a linear program. For each fixed feasible , minimizing over gives exactly by the threshold formula for the sum of the largest components; hence the reformulation preserves the optimal value and optimal whenever an optimum exists.
Past exam of the mathematics course of the University of Cambridge 2021 ib Paper 2 7H Solution Created 2026-09-24 Updated 2026-09-25
Introduce slack variables . In the initial simplex algorithm dictionary, has the largest positive objective coefficient. The ratio test givesso enters and leaves. Solving the third constraint for givesThe objective becomesEvery reduced cost is now nonpositive, so the simplex optimality criterion givesThe other two slacks both equal one.
The dual linear program isThe vectoris dual feasible and has objective value . By weak duality, it and the displayed primal point are optimal; they also satisfy complementary slackness.
If has rows and columns, attach a nonnegative dual variable to each of the upper-bound constraints. The dual linear program isHere is the transpose of , and all vector inequalities hold componentwise. Nonnegative dual variables preserve the direction of the original inequalities when taking weighted sums.
There are two primal inequalities, so there are two nonnegative dual variables. The five primal variables yield five dual inequalities:Each coefficient column of the primal linear program becomes one row of this dual linear program.
The dual linear program isFor feasible , nonnegativity and the two constraint inequalities imply weak duality:If a feasible pair has equal objectives, every primal feasible objective is at most that common value and every dual feasible objective at least it. Thus both feasible solutions are optimal. Strong duality is not needed for this certificate.
For the primal equality-form linear program, the dual linear program isIf is primal feasible and dual feasible, thenThis proves weak duality. Their objective gap is , a sum of nonnegative terms. The complementary slackness theorem states that a feasible pair is optimal for the two programmes exactly whenThese conditions make the gap zero, which by weak duality certifies optimality; necessity follows from strong duality.
Standard maximum form of a linear program Created 2026-10-24 Updated 2026-10-31
This convention for standard maximum form of a linear program requires a maximizing linear function, upper-bound linear inequalities, and nonnegative variables. An unrestricted variable becomes the difference of two nonnegative variables; a lower-bound inequality changes sign. The corresponding dual linear program is . Adding nonnegative slack variables instead gives the equivalent equality-constraint standard form. Since standard-form terminology varies, state the chosen convention.
Strictly slack dual constraints force zero primal variables Created 2026-10-25 Updated 2026-10-31
For the primal linear program maximising with , , and its dual linear program minimising with , , let be optimal. The complementary slackness identity gives . Thus a strict inequality in the th dual constraint forces . One optimal dual feasible solution can therefore force zero components in every primal optimum. The same argument with roles reversed says that forces the th primal constraint to be an equality.
