# Left-Right Justify a Matrix

Question: I wish to separate given matrices, I mean A on left side and B on right side.

MWE

\documentclass[12pt, a4paper]{article}
\usepackage[top=0.8 in,bottom=0.8 in,left=0.7 in,right=0.6 in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[misc]{ifsym}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\begin{document}
$$A = \begin{bmatrix} 1 & 0 & 0 \$0.3em] 0 & 1 & 0 \\[0.3em] 0 & 0 & 1 \end{bmatrix}B = \begin{bmatrix} 1 & 0 & 0 \\[0.3em] 0 & 1 & 0 \\[0.3em] 0 & 0 & 1 \end{bmatrix} \end{document}  ## 2 Answers You could insert either \qquad or \qquad\qquad to achieve some separation: Incidentally, don't use  to initiate and terminate display math mode in a LaTeX document; use \[ and $ instead. For more on this subject, see the posting Why is $...$ preferable to $$ ... 

\documentclass[12pt, a4paper]{article}
\usepackage[vmargin=0.8in,left=0.7in,right=0.6in]{geometry}
\usepackage[utf8]{inputenc}
%\usepackage[misc]{ifsym} % this package is ancient
\usepackage{amsmath,amsfonts,amssymb}
\renewcommand\arraystretch{1.25}
\begin{document}
\noindent
$A = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \qquad B = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}$
$\renewcommand\arraystretch{1.25} A = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \qquad\qquad B = \begin{bmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0 \end{bmatrix}$
\end{document}

• Good any other option like \hfill Can we move both matrices on left and right side? – Math-Man Jan 5 '17 at 6:40
• @snehal - \hfill won't work. However, \kern340pt will. – Mico Jan 5 '17 at 7:13

You can have the matrices at each margin with \flalign*, from amsmath. Incidentally, if you have several rows to align, you also can use align*, or alignat* to have control on the distance between the matrices:

    \documentclass[12pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[vmargin=0.8in,left=0.7in,right=0.6in, showframe]{geometry}
\usepackage{mathtools, amsfonts, amssymb}
\renewcommand\arraystretch{1.25}

\begin{document}

\begin{flalign*}
\shortintertext{\texttt{With flalign*: }}
A = \begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{bmatrix} & & & & & B = \begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{bmatrix}
\end{flalign*}

\begin{alignat*}{2}
\shortintertext{\texttt{With alignat*: }}
& A = \begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{bmatrix} & \hspace{4em}& B = \begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{bmatrix}
\end{alignat*}

\begin{align*}
\shortintertext{\texttt{With align*: }}
& A = \begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{bmatrix} & & B = \begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{bmatrix}
\end{align*}

\end{document}