# linear algebra – A question about implementation of Farkas lemma

The Farkas Lemma: Let $$A$$ be an $$mtimes n$$ matrix, $$binmathcal{R}^m$$. Then exactly one of the following two assertions is true:
(1) There exists an $$xin mathcal{R}^n$$ such that $$Ax=b$$ and $$xge0$$.
(2) There exists a $$yin mathcal{R}^m$$ such that $$A^Tyge0$$ and $$b^Ty<0$$.

I want to check which assertion is true for a given $$b$$. So I constructed the linear programming problem according to the second statement:
$$begin{equation} min b^Ty\ s.t. -A^Tyle0 end{equation}$$
The idea is simple. if the solution $$b^Ty$$ is great than or equal to $$0$$, then the first assertion is true; otherwise the second one is true.

But the following matlab implementation always gives me the result $$y=0$$ or “the problem is unbounded”. Something is wrong, but i have no idea. I would be thankful for any help or references.

``````m = 2;
n = 4;
A = rand(m,n);
b = rand(m,1);
f = b;
A = -A';
y = linprog(f,A,zeros(n,1),(),(),(),());
``````