# Farkas' lemma

Farkas' lemma is a solvability theorem for a finite system of linear inequalities in mathematics. It was originally proven by the Hungarian mathematician Gyula Farkas.[1] Farkas' lemma is the key result underpinning the linear programming duality and has played a central role in the development of mathematical optimization ( alternatively, mathematical programming). It is used amongst other things in the proof of the Karush–Kuhn–Tucker theorem in nonlinear programming.

Generalizations of the Farkas' lemma are about the solvability theorem for convex inequalities,[2] i.e., infinite system of linear inequalities. Farkas' lemma belongs to a class of statements called "theorems of the alternative": a theorem stating that exactly one of two systems has a solution.

## Statement of the lemma

There are a number of slightly different (but equivalent) formulations of the lemma in the literature. The one given here is due to Gale, Kuhn & Tucker (1951).

Farkas' lemma —  Let ${\displaystyle \mathbf {A} \in \mathbb {R} ^{m\times n}}$ and ${\displaystyle \mathbf {b} \in \mathbb {R} ^{m}}$ . Then exactly one of the following two statements is true:

1. There exists an ${\displaystyle \mathbf {x} \in \mathbb {R} ^{n}}$ such that ${\displaystyle \mathbf {Ax} =\mathbf {b} }$ and ${\displaystyle \mathbf {x} \geq 0}$.
2. There exists a ${\displaystyle \mathbf {y} \in \mathbb {R} ^{m}}$ such that ${\displaystyle \mathbf {A} ^{\mathsf {T}}\mathbf {y} \geq 0}$ and ${\displaystyle \mathbf {b} ^{\mathsf {T}}\mathbf {y} <0}$.

Here, the notation ${\displaystyle \mathbf {x} \geq 0}$ means that all components of the vector ${\displaystyle \mathbf {x} }$ are nonnegative. Let the cone generated by the columns of ${\displaystyle \mathbf {A} }$ denoted by ${\displaystyle C(\mathbf {A} )=\{\mathbf {A} \mathbf {x} |\mathbf {x} \geq 0\}}$. Then ${\displaystyle C(\mathbf {A} )}$ is a closed convex cone. The vector ${\displaystyle \mathbf {x} }$ proves that ${\displaystyle \mathbf {b} }$ lies in ${\displaystyle C(\mathbf {A} )}$ while the vector ${\displaystyle \mathbf {y} }$ gives a linear functional that separates ${\displaystyle \mathbf {b} }$ from ${\displaystyle C(\mathbf {A} )}$.

Let ${\displaystyle \mathbf {a} _{1},\dots ,\mathbf {a} _{n}\in \mathbb {R} ^{m}}$ denote the columns of ${\displaystyle \mathbf {A} }$. In terms of these vectors, Farkas' lemma states that exactly one of the following two statements is true:

1. There exist coefficients ${\displaystyle x_{1},\dots ,x_{n}\in \mathbb {R} ,x_{1},\dots ,x_{n}\geq 0}$ , such that ${\displaystyle \mathbf {b} =x_{1}\mathbf {a} _{1}+\dots +x_{n}\mathbf {a} _{n}}$ .
2. There exists a vector ${\displaystyle \mathbf {y} \in \mathbb {R} ^{m}}$ such that ${\displaystyle \mathbf {a} _{i}^{\mathsf {T}}\mathbf {y} \geq 0}$ for ${\displaystyle i=1,\dots ,n}$ and ${\displaystyle \mathbf {b} ^{\mathsf {T}}\mathbf {y} <0}$.

The vectors ${\displaystyle x_{1}\mathbf {a} _{1}+\dots +x_{n}\mathbf {a} _{n}}$ with nonnegative coefficients constitute the convex cone of the set ${\displaystyle \{\mathbf {a} _{1},\dots ,\mathbf {a} _{n}\}}$ so the first statement says that ${\displaystyle \mathbf {b} }$ is in this cone.

The second statement says that there exists a vector ${\displaystyle \mathbf {y} }$ such that the angle of ${\displaystyle \mathbf {y} }$ with the vectors ${\displaystyle \mathbf {a} _{i}}$ is at most 90° while the angle of ${\displaystyle \mathbf {y} }$ with the vector ${\displaystyle \mathbf {b} }$ is more than 90°. The hyperplane normal to this vector has the vectors ${\displaystyle \mathbf {a} _{i}}$ on one side and the vector ${\displaystyle \mathbf {b} }$ on the other side. Hence, this hyperplane separates the vectors in the cone of ${\displaystyle \{\mathbf {a} _{1},\dots ,\mathbf {a} _{n}\}}$ and the vector ${\displaystyle \mathbf {b} }$.

For example, let n,m=2 and a1 = (1,0)T and a2 = (1,1)T. The convex cone spanned by a1 and a2 can be seen as a wedge-shaped slice of the first quadrant in the x-y plane. Now, suppose b = (0,1). Certainly, b is not in the convex cone a1x1+a2x2. Hence, there must be a separating hyperplane. Let y = (1,−1)T. We can see that a1 · y = 1, a2 · y = 0, and b · y = −1. Hence, the hyperplane with normal y indeed separates the convex cone a1x1+a2x2 from b.

## Generalizations

Generalized Farkas' lemma —  Let ${\displaystyle \mathbf {A} \in \mathbb {R} ^{m\times n}}$ , ${\displaystyle \mathbf {b} \in \mathbb {R} ^{m}}$, ${\displaystyle \mathbf {S} }$ is a closed convex cone in ${\displaystyle \mathbb {R} ^{n}}$ and the dual cone of ${\displaystyle \mathbf {S} }$ is ${\displaystyle \mathbf {S^{*}} =\{\mathbf {z} \in \mathbb {R} ^{n}|\mathbf {z} ^{\mathsf {T}}\mathbf {x} \geq 0,\forall \mathbf {x} \in \mathbf {S} \}}$. If convex cone ${\displaystyle C(\mathbf {A} )=\{\mathbf {A} \mathbf {x} |\mathbf {x} \in \mathbf {S} \}}$ is closed, then exactly one of the following two statements is true:

1. There exists an ${\displaystyle \mathbf {x} \in \mathbb {R} ^{n}}$ such that ${\displaystyle \mathbf {Ax} =\mathbf {b} }$ and ${\displaystyle \mathbf {x} \in \mathbf {S} }$.
2. There exists a ${\displaystyle \mathbf {y} \in \mathbb {R} ^{m}}$ such that ${\displaystyle \mathbf {A} ^{\mathsf {T}}\mathbf {y} \in \mathbf {S^{*}} }$ and ${\displaystyle \mathbf {b} ^{\mathsf {T}}\mathbf {y} <0}$.

Generalized Farkas' lemma can be interpreted geometrically as follows: a vector is either in a given closed convex cone or that there exists a hyperplane separating the vector from the cone—there are no other possibilities. The closedness condition is necessary, see Separation theorem I in Hyperplane separation theorem. For original Farkas' lemma, ${\displaystyle \mathbf {S} }$ is the nonnegative orthant ${\displaystyle \mathbb {R} _{+}^{n}}$, hence the closedness condition holds automatically. Indeed, for polyhedral convex cone, i.e., there exists a ${\displaystyle \mathbf {B} \in \mathbb {R} ^{n\times k}}$ such that ${\displaystyle \mathbf {S} =\{\mathbf {B} \mathbf {x} |\mathbf {x} \in \mathbb {R} _{+}^{k}\}}$, the closedness condition holds automatically. In convex optimization, various kinds of constraint qualification, e.g. Slater's condition, are responsible for closedness of the underlying convex cone ${\displaystyle C(\mathbf {A} )}$.

By setting ${\displaystyle \mathbf {S} =\mathbb {R} ^{n}}$ and ${\displaystyle \mathbf {S^{*}} =\{0\}}$ in Generalized Farkas' lemma, we obtain the following corollary about the solvability for a finite system of linear equalities.

Corollary —  Let ${\displaystyle \mathbf {A} \in \mathbb {R} ^{m\times n}}$ and ${\displaystyle \mathbf {b} \in \mathbb {R} ^{m}}$. Then exactly one of the following two statements is true:

1. There exists an ${\displaystyle \mathbf {x} \in \mathbb {R} ^{n}}$ such that ${\displaystyle \mathbf {Ax} =\mathbf {b} }$.
2. There exists a ${\displaystyle \mathbf {y} \in \mathbb {R} ^{m}}$ such that ${\displaystyle \mathbf {A} ^{\mathsf {T}}\mathbf {y} =0}$ and ${\displaystyle \mathbf {b} ^{\mathsf {T}}\mathbf {y} \neq 0}$.

## Further implications

Farkas's lemma can be varied to many further theorems of alternative by simple modifications, such as Gordan's theorem: Either ${\displaystyle Ax<0}$ has a solution x, or ${\displaystyle A^{\mathsf {T}}y=0}$ has a nonzero solution y with y ≥ 0.

Common applications of Farkas' lemma include proving the strong and weak duality theorem associated with linear programming, game theory at a basic level and the Kuhn–Tucker constraints. An extension of Farkas' lemma can be used to analyze the strong duality conditions for and construct the dual of a semidefinite program. It is sufficient to prove the existence of the Kuhn–Tucker constraints using the Fredholm alternative but for the condition to be necessary, one must apply Von Neumann's minimax theorem to show the equations derived by Cauchy are not violated.

A particularly suggestive and easy-to-remember version is the following: if a set of inequalities has no solution, then a contradiction can be produced from it by linear combination with nonnegative coefficients. In formulas: if ${\displaystyle Ax}$${\displaystyle b}$ is unsolvable then ${\displaystyle y^{\mathsf {T}}A=0}$, ${\displaystyle y^{\mathsf {T}}b=-1}$, ${\displaystyle y}$${\displaystyle 0}$ has a solution.[3] (Note that ${\displaystyle y^{\mathsf {T}}A}$ is a combination of the left hand sides, ${\displaystyle y^{\mathsf {T}}b}$ a combination of the right hand side of the inequalities. Since the positive combination produces a zero vector on the left and a −1 on the right, the contradiction is apparent.)