Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting two matrices in one line

Tags:

matrix

latex

im trying to get these to appear in the same line without any success, my coding is

\begin{equation}
P^+=\[ \left( \begin{array}{ccc}
1 & 0\\
0 & 0\end{array} \right)\]
P^-=\[ \left( \begin{array}{ccc}
0 & 0\\
0 & 1\end{array} \right)\]
\end{equation} 

any hints or suggestions would be welcome

like image 937
cal Avatar asked Dec 17 '22 04:12

cal


2 Answers

Get rid of all the \[ and \], and add some space between them:

\begin{equation}
P^+= \left( \begin{array}{ccc}
1 & 0\\
0 & 0\end{array} \right)\qquad
P^-= \left( \begin{array}{ccc}
0 & 0\\
0 & 1\end{array} \right)
\end{equation}
like image 186
Rob Hyndman Avatar answered Feb 15 '23 04:02

Rob Hyndman


With the AMS-LaTeX package, you can accomplish this task more conveniently with the align and pmatrix environments:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
P^+ &= \begin{pmatrix}
    1 & 0 \\
    0 & 0
\end{pmatrix}
&
P^- &= \begin{pmatrix}
    0 & 0 \\
    0 & 1
\end{pmatrix}
\end{align}
\end{document}
like image 36
las3rjock Avatar answered Feb 15 '23 03:02

las3rjock