## LaTeX forum ⇒ Math & Science ⇒ Matrix within a matrix

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
davefulton
Posts: 8
Joined: Wed May 05, 2010 8:36 pm

### Matrix within a matrix

Hello all,
I am trying to get this array
\begin{equation}U = \left( \begin{array}{c}\rho\\\rho u\\\rho v\end{array} \right),\end{equation}

into the values marked x in this array
$F^+(U) = \left\{ \begin{array}{ll} x & \mbox{x \geq 0};\\ x & \mbox{x \geq 0};\\ -x & \mbox{x < 0}.\end{array} \right.$

so something like
$F^+(U) = \left\{ \begin{array}{ll} \begin{equation}U = \left( \begin{array}{c} \rho\\ \rho u\\ \rho v\end{array} \right),\end{equation} & \mbox{x \geq 0};\\ x & \mbox{x \geq 0};\\ -x & \mbox{x < 0}.\end{array} \right.$

however this won't compile. Any help

Stefan Kottwitz
Posts: 9616
Joined: Mon Mar 10, 2008 9:44 pm
Hi,

it would work without the equation environment:
$F^+(U) = \left\{ \begin{array}{ll} U = \left( \begin{array}{c} \rho\\ \rho u\\ \rho v\end{array} \right), & \mbox{x \geq 0};\\ x & \mbox{x \geq 0};\\ -x & \mbox{x < 0}.\end{array} \right.$

Stefan

php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm
As another option, try using the 'cases' environment together with the 'pmatrix' environment provided by the amsmath package.
\documentclass{article} \usepackage{amsmath} \begin{document} $F^+(U) = \begin{cases}\begin{pmatrix}\rho\\\rho u\\\rho v\end{pmatrix} & \mbox{x \geq 0};\\[5ex]\begin{pmatrix}\rho\\\rho u\\\rho v\end{pmatrix} & \mbox{x \geq 0};\\[5ex]-\begin{pmatrix}\rho\\\rho u\\\rho v\end{pmatrix} & \mbox{x < 0} \end{cases}$ \end{document}

davefulton
Posts: 8
Joined: Wed May 05, 2010 8:36 pm
Thank you, thank you, thank you x

localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm
Now that the problem is solved, please mark the topic accordingly as described in Section 3 of the Board Rules. This applies to all your other requests.

Best regards
Thorsten
LaTeX Community Moderator

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1