# Alignment of Matrix Equations

I want the code below to appear in one line but the last array (the transposed one) appears on the line below. What should I do?

\begin{equation}

X'X=(V_r,V_{p-r}) $\left( \begin{array}{cc} \Lambda_r & 0 \\ 0 & \Lambda_{p-r} \end{array} \right)$ $\left( \begin{array}{c} V'_r\\ V'_{p-r} \end{array} \right)$

\end{equation}


$...$ initiates a display math environment, which you don't need inside the equation environment, since you're already inside math mode. \documentclass{article}
\begin{document}
\begin{equation}
X'X = (V_r, V_{p-r}) \left( \begin{array}{cc}
\Lambda_r & 0 \\
0 & \Lambda_{p-r}
\end{array} \right) \left( \begin{array}{c}
V'_r \\
V'_{p-r}
\end{array} \right)
\end{equation}
\end{document}


Also see Where is the \matrix command? for more ways of typesetting matrices.

Here is a minor adjustment that uses the \biggl/\biggr pair rather than \left/\right, and also reduces the outer column specification: \documentclass{article}
\begin{document}
\begin{equation}
X'X = (V_r, V_{p-r}) \biggl( \begin{array}{@{}cc@{}}
\Lambda_r & 0 \\
0 & \Lambda_{p-r}
\end{array} \biggr) \biggl( \begin{array}{@{}c@{}}
V'_r \\
V'_{p-r}
\end{array} \biggr)
\end{equation}
\end{document}

• One might as well replace the \biggl(\begin{array}{@{}cc@{}}...\end{array}\biggr) with \begin{pmatrix}...\end'pmatrix} from amsmath so as to have something lighter to type, I think. Jan 31, 2014 at 21:29
• @Bernard: ...hence the reference to Where is the \matrix command?
– Werner
Jan 31, 2014 at 21:30
• Oops! I apologise not to have seen all the details – just wondered why you hadn't proposed this environment. Jan 31, 2014 at 22:25