I would like to write an environment to write linear system of equations that could be used with
\begin{linearSystem}
2x&+y&=&2\\
x&-3y&=&1
\end {linearSystem}
and should display
2x +y=2
x-3y=1
Every piece of equation should be aligned on the right and no spacing should be added.
I have tried to use the aligned environment with
\[\left\{\begin{aligned}[c]
2x&+y&=&2\\
x&-3y&=&1
\end{aligned}\right.\]
But I get something like
2x+y =2
x-3y =1
which is not what I want. Is there a way to have an "aligned" environment that justifies everything on the right and that does not introduce any spacing every 2 "pieces" of equation.



\begin{eqnarray*} \hfill 2x+y=2\\ \hfill 3y=1 \end {eqnarray*}– Samjith Jul 22 '19 at 13:02