Farkas' lemma Created 2026-10-07 Updated 2026-10-14
For a real matrix and a vector , exactly one of the following systems has a solution:
The linear inequalities here are componentwise. In the first system is nonnegative; in the second system is unrestricted in sign. The second system is a certificate that the first has no feasible point. This nonnegative-equations alternative is developed in Boyd and Vandenberghe, Convex Optimization slides, §5.34.
Build the target, or separate it. Write the columns of as . Then is a conic combination: its coefficients must be nonnegative, but need not sum to one. The obtainable targets form the finitely generated cone
A solution explains how to build from those columns. A certificate instead defines a linear functional . The condition says that its dot product with every generating column is nonnegative, and hence with every point of . But places the target strictly on the other side of the hyperplane . Thus belongs to the dual cone of and rules out every allowed conic combination at once.
A certificate that can be checked by eye. Take the identity matrix
Here is the nonnegative orthant. The equation forces , violating . The certificate gives
The linear functional simply reads the first coordinate: all allowed column combinations have a nonnegative first coordinate, while has first coordinate . For comparison, the target is obtained with .
Figure 1.
Nonnegative column combinations lie in a cone, while a Farkas certificate separates the target
. For , the shaded nonnegative orthant is the conic hull of the two columns. The hyperplane for is the vertical axis; lies strictly on its negative side. The obtainable target illustrates the other alternative. Details.
Why this is useful and striking. A successful search can exhibit one feasible point; an unsuccessful search alone cannot explain why every candidate fails. Farkas' lemma guarantees an equally concrete witness of impossibility for this finite linear problem. Once is supplied, verification needs only matrix multiplication, sign tests and one dot product. The same idea gives a Farkas certificate for linear inequalities and underlies linear programming duality.
Brief geometric proof. The two systems cannot both hold, because they would imply
For existence of a certificate when , closedness of finitely generated cones makes a closed convex cone, so separation from a closed convex cone supplies and for every . Testing each column gives . Concretely, let be the Euclidean projection onto a convex set of onto and set . The projection inequality gives for . Testing and gives , whence . In the example, and . Alternatively, the Fenchel-Moreau theorem applied to the cone's indicator functional proves the same separation through its polar cone.
An original historical source is Julius Farkas's [ref]. The linked archival record verifies the author, title and publication details.
The dual linear program is the minimization problem
Indeed, 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 cone
This 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 . Consequently
In particular and . Rescaling by the positive number produces the requested Farkas' lemma certificate:
Now a feasible point of the relaxed inequalities would satisfy
Since , the sum of the nonnegative is positive. Thus robust infeasibility under uniform constraint relaxation gives
The 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.
One form of Farkas' lemma states that exactly one of the following holds:
Their mutual exclusion is immediate: if both held, .
For existence of the alternative certificate, let , the finitely generated cone of the columns of . It is convex. It is also closed, a fact that must be justified rather than assumed for arbitrary linear images of closed cones. In a representation with dependent active generators, choose a nonzero dependence with at least one . Subtract
from the nonnegative coefficient vector. The represented point is unchanged, all coefficients remain nonnegative, and at least one active coefficient disappears. Iteration produces a representation with independent active columns. For a convergent sequence in , pass to a subsequence using the same independent set, possible because there are finitely many sets. Its coefficients converge through a fixed left inverse, and their limits remain nonnegative. This proves closedness of finitely generated cones.
The indicator functional is therefore proper, lower semicontinuous and convex. Its Legendre-Fenchel transform is
Indeed a positive pairing with a cone generator can be scaled arbitrarily, while all nonpositive pairings give supremum zero. The Fenchel-Moreau theorem now gives
If , the left side is infinite, so some feasible has . Taking gives and . If , the first alternative holds. The biconjugation theorem applied to a closed finitely generated cone proves the alternative.
For inequalities with unrestricted , split and add nonnegative slack:
The equivalent Farkas certificate for linear inequalities is