# How to have a variable in more than two row-column in matrices?

I have a matrix say 3 by 3, in it I have a variable say G, which is 2 by 2. But I don't know how to have such a matrix variable inside another one without splitting G?

• Welcome to TeX.SX! Your question is unclear. – user31729 Nov 14 '15 at 14:50
• I want a variable to feel more than one cell in a matrix, like the second example in answer by @MickG – user85361 Nov 15 '15 at 6:12
• I would have been nice to know this in advance ;-) Please clearify your next posts! – user31729 Nov 15 '15 at 9:31
• @christian hupfer, thank you for recommendation, but actually I think my question is clear. I wanted a "variable", but your answer is a constant. – user85361 Nov 15 '15 at 20:45
• Arguable but I keep my solution anyway – user31729 Nov 15 '15 at 21:46

Another solution uses the multirow and multicol packages:

\documentclass[a4paper]{report}
\usepackage{amsmath,multirow,multicol}

\begin{document}
$\left(\begin{array}{ccc} \multicolumn{2}{c}{\multirow{2}{*}{\left(\begin{array}{cc} 1 & 0 \\ 0 & 1 \end{array}\right)}} & 0 \\ & & 0 \\ \multicolumn{2}{c}{\begin{array}{cc} 0 & 0 \end{array}} & 1 \end{array}\right) \quad \left(\begin{array}{ccc} \multicolumn{2}{c}{\multirow{2}{*}{\HugeG}} & 0 \\ & & 0 \\ 0 & 0 & 1 \end{array}\right)$
\end{document}


For more info about the arguments passed to \multicolumn and \multirow, read the documentation of the relevant packages. To adjust the alignment, one can use \raisebox (vertical) or add space (horizontal). The second multicolumn in the first example is to correctly align the 0 on the bottom-left corner, which would otherwise be too far to the left -- try and see!

• As I suspected :). You're welcome. As you will know, there are other font size macros (\large, \LARGE, etc.) – MickG Nov 15 '15 at 8:39

Matrix in matrix can be nested and using the bracket - less matrix environment to keep the columns or rows aligned.

\documentclass{article}

\usepackage{mathtools}
\begin{document}
$\begin{pmatrix} \begin{pmatrix} 1 & 0 \\ 0 & 1 \\ \end{pmatrix} & \begin{matrix} 2 \\ 1 \end{matrix} \\ \begin{matrix} 4 & 3 \end{matrix} & 5 \\ \end{pmatrix}$
\end{document}


The spacing is however changed a little bit:

Another way to show submatrices:

\documentclass{article}
\usepackage{mathtools}
\begin{document}
$\left( \begin{array}{cc|c} 1 & 0 & 2 \\ 0 & 1 & 1 \\ \hline 4 & 3 & 5 \end{array} \right)$
\end{document}