# How to have matrices side by side in latex?

I'm new to latex and all of my matrices seem to be created on new lines, I can't seem to put them side by side. Here is what I am doing to make a matrix (with the 2d identity matrix as an example):

$\left( \begin{array}{cc} 1 & 0 \\ 0 & 1 \end{array} \right)$


Am I making it wrong? How can I place a second matrix directly beside this, as you would when doing matrix mathematics? Thanks

-

Don't enclose each array with $...$; instead, put all the arrays that you want together within one set of delimeters. Like this:

$\left( \begin{array}{cc} 1 & 0 \\ 0 & 1 \end{array} \right) % \left( \begin{array}{cc} 1 & 0 \\ 0 & 1 \end{array} \right)$


You should read the mathmode documentation. It should be part of your TeX Distribution, and has lots of examples to follow.

-
This makes sense. However, does this still handle things like [Matrix][vector] = [vector] all one one line? – user3231 Jan 29 '11 at 20:49
@bbel Sure. As long as they will fit on the same line, you can just put them one after another like this (no blank lines in between which is why I separated the two matrices in my example with a % (comment character)). – Alan Munn Jan 29 '11 at 20:52

like this

$\left( \begin{array}{cc} 1 & 0 \\ 0 & 1 \end{array} \right) \times \left( \begin{array}{cc} 1 & 0 \\ 0 & 1 \end{array} \right) =\left( \begin{array}{cc} 1 & 0 \\ 0 & 1 \end{array} \right)$


You need to place the matrices inside the math environment

-
Inside the math environment by surrounding them with the dollar sign operator? Because that gives me errors in itself.. – user3231 Jan 29 '11 at 20:45
$..$ is a math environment When you use this environment the math expression is written on a single line. Like Alan, I think you should read the mathmode.pdf documentation from Herbert Voss. – Alain Matthes Jan 29 '11 at 21:18

This is slightly tangential, but you might find it convenient to use the pmatrix environment (defined in amsmath.sty)

$\begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/k} \end{pmatrix} \begin{pmatrix} u \\ v \end{pmatrix} = \begin{pmatrix} u \\ -v \end{pmatrix}$

-