Take a look at the following simplex tableau:
The pivot element is at (1,1) with a value of 2. Eliminating other rows I get the next tableau:

That is the last step since there is no negative values in the last row, so it's time to extract the solution.
I read from many sources that in order to extract solutions for $X_i$ variables you need to compute $X_i=\frac{b_i}{x_i}$ ($X_i$ is a solution, $x_i$ is a value in the tableau) for variables that are basic, while solution for variables that are non-basic is zero. And often it is the case.
But that is not the case for my tableau. Here you can see that $x_2,s_1,s_3$ are basic variables. So solution for $x_1$ should be zero, right?
Even though the $x_1$ is non-basic variable, I can solve for it from the first equation (the first tableau row): $$ 4x_1+s_1+s_2=8 $$ Having slack variables as zeros, I get $x_1=2$. Substituting $x_1$ into the second equation (the second row in the tableau): $$ -x_1+2x_2+s_2=4 $$ I solve for $x_2$ and get $x_2=3$. Which is the correct result.
To confirm that, I solved the linear programming problem using graphical method and got the result $X=(2,3)$:

So $x_1$ has a non zero solution even though it was non-basic variable. What then is the algorithm for extracting the solution from the tableau above? Having written a program, how should it read the solution from the tableau?
