System of equations with indices alignment

alignat uses pairs columns with rl-alignment. In your example the last column is of type r. So the last column will be right aligned - see the commented line in the following code snippet:

\begin{alignat}{3}% 3 r-columns 
%         r & l              &           r & l               &        r 
  a_{11}x_1 & {}+{}a_{12}x_2 & {}+{} \dots & {}+{} a_{1n}x_n & {}={}b_1\\
  a_{21}x_1 & {}+{}a_{22}x_2 & {}+{} \dots & {}+{} a_{2n}x_n & {}={}b_2\\
  a_{m1}x_1 & {}+{}a_{m2}x_2 & {}+{} \dots & {}+{} a_{mn}x_n & {}={}b_m
\end{alignat}

Note that the argument of the alginat environment takes the numbers of r columns.

To get the desired result you have to ensure that the columns get the right alignment. In the following example there ars two suggestions with the same result:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat}{3}% 3 r-columns 
%         r & l              &           r & l               & r & l
  a_{11}x_1 & {}+{}a_{12}x_2 & {}+{} \dots & {}+{} a_{1n}x_n &   & {}={}b_1\\
  a_{21}x_1 & {}+{}a_{22}x_2 & {}+{} \dots & {}+{} a_{2n}x_n &   & {}={}b_2\\
  a_{m1}x_1 & {}+{}a_{m2}x_2 & {}+{} \dots & {}+{} a_{mn}x_n &   & {}={}b_m
\end{alignat}

\begin{alignat}{3}% 3 r-columns 
%         r & l              &           r & l               &     r & l
  a_{11}x_1 & {}+{}a_{12}x_2 & {}+{} \dots & {}+{} a_{1n}x_n & {}={} & b_1\\
  a_{21}x_1 & {}+{}a_{22}x_2 & {}+{} \dots & {}+{} a_{2n}x_n & {}={} & b_2\\
  a_{m1}x_1 & {}+{}a_{m2}x_2 & {}+{} \dots & {}+{} a_{mn}x_n & {}={} & b_m
\end{alignat}
\end{document}

enter image description here


Based on my comment:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat}{6}
    a_{11}x_1&{}+{}a_{12}x_2&{}+{} \dots&{}+{} a_{1n}x_n&{}={}&b_1\\
    a_{21}x_1&{}+{}a_{22}x_2&{}+{} \dots&{}+{} a_{2n}x_n&{}={}&b_2\\
    a_{m1}x_1&{}+{}a_{m2}x_2&{}+{} \dots&{}+{} a_{mn}x_n&{}={}&b_m
\end{alignat}
\end{document}

With array:

\documentclass{article}
\usepackage{array,mathtools}

\begin{document}

\[
\renewcommand{\arraystretch}{1.5}
\setlength{\arraycolsep}{0pt}
\def\bvdots{\vdotswithin{=}}
\begin{array}{
 l l >{{}}c<{{}}   % a_{11} & x_1 & +
 l l >{{}}c<{{}}   % a_{12} & x_2 & +
 c >{{}}c<{{}}     % \cdots +
 l l >{{}}c<{{}} l % a_{12} & x_2 & = & b_1
}
  a_{11} & x_1 & + & a_{12} & x_2 & + & \cdots & + & a_{1n} & x_n & = & b_1 \\
  a_{21} & x_1 & + & a_{22} & x_2 & + & \cdots & + & a_{2n} & x_n & = & b_2 \\
         &     &   &        &     &   &        &   &        &     & \bvdots \\
  a_{m1} & x_1 & + & a_{m2} & x_2 & + & \cdots & + & a_{mn} & x_n & = & b_m
\end{array}
\]

\end{document}

enter image description here

Just for fun, with autoaligne:

\documentclass{article}
\usepackage{autoaligne}

\begin{document}

\[
\definirseparateurs{\\}{+|| }{=||V}
\endlinechar=-1
\def\bvdots{\kern-2em\vdots}
\autoaligne[*g]{
  a_{11} x_1+a_{12} x_2+\cdots+a_{1n} x_n=b_1\\
  a_{21} x_1+a_{22} x_2+\cdots+a_{2n} x_n=b_2\\
  + + + V \bvdots\\
  a_{m1} x_1+a_{m2} x_2+\cdots+a_{mn} x_n=b_m
}
\]

\end{document}

enter image description here