I am trying to maximize my objective function $$3x_1+5x_2$$ subject to \begin{align} x_1+2x_2&\leq5\\ x_1&\leq3\\ x_2&\leq2\end{align}
where $$x_1,x_2 \geq0 $$
so this is what I did \begin{align} x_3&=5-x_1-2x_1 \\ x_4&=3-x_1\\ x_5&=2-x_2\\ z&=3x_1+5x_2\end{align}
I chose $x_2$ since it has the bigger coefficient, then replaced $x_5$, resulting in
\begin{align}x_2&=2-x_5\\ x_3&=1-x_1+2x_5\\ x_4&=3-x_1\\ z&=10+3x_1-5x_5\end{align}
I then chose $x_1$ and replaced $x_3$ to get
\begin{align}x_1&=1-x_3+2x_5\\ x_2&=2-x_5\\ x_4&=2+x_3-2x_5\\ z&=13-3x_3+x_5\end{align}
I then chose $x_5$ and replaced $x_2$ to get \begin{align}x_5&=2-x_2\\ x_1&=5-2x_2-x_3\\ x_4&=-2+x_2+x_3\\ z&=15-x_2-3x_3\end{align}
However, the optimal solution is supposed to be $14$, where I should have replaced $x_4$ in my last iteration. I have no idea why was $x_4$ chosen over $x_2$, can someone help me?



