Let AA be an m×nm \times n matrix and cc be an nn-vector. Then Farkas's lemma states that exactly one of the systems

Ax0,cTx>0 \begin{aligned} Ax & \le 0, \\ c^Tx & > 0 \end{aligned}

and

ATy=c,y0 \begin{aligned} A^Ty & = c, \\ y & \le 0 \end{aligned}

is solvable, where xx is an nn-vector and yy is an mm-vector. Prove Farkas's lemma.

Suppose that both systems are solvable, let xx denote a solution to the first system, and yy denote a solution to the second. Taking transposes we have xTAT0Tx^{\text T}A^{\text T} \le 0^{\text T}. Right multiplying by yy gives xTc=xTATy0Tx^{\text T}c = x^{\text T}A^{\text T}y \le 0^{\text T}, which is a contradiction to the fact that cTx>0c^{\text T}x > 0. Thus, both systems cannot be simultaneously solved. Now suppose that the second system fails. Consider the following linear program:

maximize 0x subject to ATy=c and y0,\text{maximize } 0x \text{ subject to } A^{\text T}y = c \text{ and } y \ge 0,

and its corresponding dual program

minimize cTx subject to Ax0.\text{minimize } -c^{\text T}x \text{ subject to } Ax \le 0.

Since the second system fails, the primal is infeasible. However, the dual is always feasible by taking x=0x = 0. If there were a finite solution to the dual, then duality says there would also be a finite solution to the primal. Thus, the dual must be unbounded. Thus, there must exist a vector xx which makes cTx−c^{\text T}x arbitrarily small, implying that there exist vectors xx for which cTxc^{\text T}x is strictly greater than 00. Thus, there is always at least one solution.