Suppose that I am trying to solve the following $n$-dimensional quadratic optimization problem with linear constraints ($\bf{A}$ is an $n \times n$ invertible matrix):
$\underset{\mathbf{y}\in\mathbb{R}^{n}}{\max}\;\mathbf{y}'\mathbf{b}-\frac{1}{2}\mathbf{y}'\mathbf{y}\quad\mathrm{subject\;to}\quad\mathbf{A}^{-1}\mathbf{y}\geq0$
we have the following optimality conditions:
$b_{i}-y_{i}\;\begin{cases} =0 & \mathrm{if}\;\sum_{j=1}^{n}\left[\mathbf{A}^{-1}\right]_{ij}y_{j}>0\\ <0 & \mathrm{if}\;\sum_{j=1}^{n}\left[\mathbf{A}^{-1}\right]_{ij}y_{j}=0 \end{cases}$
Now, let (by definition), $\mathbf{y}=\mathbf{A}\mathbf{x}$. Then the above conditions can be rewritten in terms of $\mathbf{x}$ as:
$b_{i}-\sum_{j=1}^{n}\left[\mathbf{A}\right]_{ij}x_{i}\;\begin{cases} =0 & \mathrm{if}\;x_{i}>0\\ <0 & \mathrm{if}\;x_{i}=0 \end{cases}$
now, suppose that we want to write the maximization problem directly in terms of $\mathbf{x}$:
$\underset{\mathbf{x}\in\mathbb{R}^{n}}{\max}\;\mathbf{x}'\mathbf{A}'\mathbf{b}-\frac{1}{2}\mathbf{x}'\mathbf{A}'\mathbf{A}\mathbf{x}\quad\mathrm{subject\;to}\quad\mathbf{x}\geq0$
then we get the following optimality conditions, which differ from the ones we obtained above:
$\sum_{j=1}^{n}\left[\mathbf{A}\right]_{ij}b_{j}-\sum_{j=1}^{n}\left[\mathbf{A}'\mathbf{A}\right]_{ij}x_{j}\;\begin{cases} =0 & \mathrm{if}\;x_{i}>0\\ <0 & \mathrm{if}\;x_{i}=0 \end{cases}$
Since it is the same maximization problem, the optimality conditions in terms of $\mathbf{x}$ should be the same. Why are they not? What am I doing wrong?