Consider the mathematical expressions as divided in columns. As Stephan_K says, the argument of alignat is the number of columns. Inside each column fix an aligment point. Then, in every line, mark with & each aligment point and also the end of each column (except the last one). So, if you have n columns, you should have 2n-1 & signs.
For the example of your first post, you could try
Code: Select all
\begin{alignat*}{2}
x_1 &+{}& 4x_2 &= -2 \\
x_1 &+{}& 2x_2 &= 6 \\
2x_1&+{}& 3x_2 &= 1
\end{alignat*}
Note the pairs of braces. They are generally needed if a binary operation falls before of after a column separation to get proper spacing. To see this, remove the braces and compare. I add a more complex example:
Code: Select all
\begin{alignat*}{4}
-7x_1 & & &+{}& 41x_3 &-{}& 14x_4&=9, \\
23x_1 &-{}& x_2 &+{}& 9x_3 & & &=-22, \\
x_1 &+{}& 10x_2 & & &+{}& 291x_4&=53, \\
& & 3x_2 &+{}& x_3 &+{}& 21x_4&=14.
\end{alignat*}
To obtain the same expressions, there are usually some possible alternatives on where putting the aligment points and columns. This may require some experimentation.