[Tex/LaTex] Define the system of “n” linear equations

math-modesysteme

I would like to write the system of "n" linear equations. Follow is my code:

 \documentclass{article}
\usepackage{amsmath}
\usepackage{systeme}

\begin{document}
\[
\syslineskipcoeff{2} 
\systeme*{w_1^S(\delta)=\alpha_1w_{11} + \alpha_2w_{21} + ...+ \alpha_nw_{n1}, w_2^S(\delta)=\alpha_1w_{12} + \alpha_2w_{22} + ...+ \alpha_nw_{n2}, x =...,w_3^S(\delta)=\alpha_1w_{1n} + \alpha_2w_{2n} + ...+ \alpha_nw_{nn}}
\]

\end{document} 

Actual Result

However, the actual result is not as what i expect (see below image). I would like to display a "…….." in the linear system to demonstrate that my index is keep increasing from i -> n. And at the end, the last equation should display index w_n^S(\delta)= instead of w_3^S(\delta)=. Unfortunately, when I write w_n^S(\delta)= LaTeX recognizes it is not number and it considers it as error Missing = inserted for \ifnum. Also, there is problem if I made "…….." in my code. Would you have any ways to work around?

Expected result

Best Answer

You can do it with systeme, but it's better with cases. A small trick ensures perfect alignment. Compare the two versions below.

\documentclass{article}
\usepackage{amsmath,mathtools,systeme}

\newcommand{\di}[2]{#1\rlap{$\scriptstyle#2$}\hphantom{n}}

\newcommand{\sysdots}{%
  \hbox{\kern-0em$\cdotp\cdotp\cdotp\cdotp\cdotp\cdotp$}%
}

\begin{document}
\[
\begin{cases}
  w_1^S(\delta)=\alpha_1w_{\di 11} + \alpha_2w_{\di 21} + \dots + \alpha_nw_{\di n1}\\
  w_2^S(\delta)=\alpha_1w_{\di 12} + \alpha_2w_{\di 22} + \dots + \alpha_nw_{\di n2}\\
  \makebox[4em]{\dotfill}\\
  w_n^S(\delta)=\alpha_1w_{\di 1n} + \alpha_2w_{\di 2n} + \dots + \alpha_nw_{\di nn}
\end{cases}
\]
\[
\syssubstitute{{w_3}{\sysdots}{w_4}{w_n}}
\systeme*{
  w_1^S(\delta)=\alpha_1w_{11} + \alpha_2w_{21} + \dots + \alpha_nw_{n1},
  w_2^S(\delta)=\alpha_1w_{12} + \alpha_2w_{22} + \dots + \alpha_nw_{n2},
  w_3,
  w_4^S(\delta)=\alpha_1w_{1n} + \alpha_2w_{2n} + \dots + \alpha_nw_{nn}
}
\]
\end{document}

enter image description here