[Tex/LaTex] tab is not working in latex

spacing

I am new in the world of latex . At this time , now I am writing thesis . I want to have tabs in tex document . For this purpose , I have written the following code .

\hspace{2cm}$ \mathbf{a_{11}x_1 + a_{12}x_2 +. . . + a_{1n}x_n = b_1 } $ \newline
                    \hspace{2cm}$\mathbf{a_{21}x_1 + a_{22}x_2 +. . . + a_{2n}x_n = b_2 }$\newline
                    \hspace{2cm} ...     ...     ...   ...    ...  ... \newline
                    \medskip ...     ...     ...   ...    ...  ...\newline
                    \medskip ...     ...     ...   ...    ...  ...\newline
                    \medskip $\mathbf{a_{n1}x_1 + a_{n2}x_2 +. . . + a_{nn}x_n = b_n }   $ \newline 

But this code generates tab in first line and then in the next line the tabs is not generated . Why ? Please help .

Best Answer

You can use \hspace*{} to get the desired effect:

enter image description here

However you really should use some sort of math environment such as align:

enter image description here

Notes:

Code:

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\noindent
\hspace{2cm}$ \mathbf{a_{11}x_1 + a_{12}x_2 +. . . + a_{1n}x_n = b_1 } $ \newline
                    \hspace*{2cm}$\mathbf{a_{21}x_1 + a_{22}x_2 +. . . + a_{2n}x_n = b_2 }$\newline
                    \hspace*{2cm} ...     ...     ...   ...    ...  ... \newline
                    \medskip\hspace*{2cm} ...     ...     ...   ...    ...  ...\newline
                    \medskip\hspace*{2cm} ...     ...     ...   ...    ...  ...\newline
                    \medskip\hspace*{2cm} $\mathbf{a_{n1}x_1 + a_{n2}x_2 +. . . + a_{nn}x_n = b_n }   $ \newline 
                    
But instead you should use
\begin{align*}
    a_{11}x_1 + a_{12}x_2 + \dotsb + a_{1n}x_n &= b_1 \\
    a_{21}x_1 + a_{22}x_2 + \dotsb + a_{2n}x_n &= b_2  \\
\end{align*}
\end{document}