# Create a block matrix with four quadrants

I want to create a block matrix of this form: But Block A should be a diagonal matrix with 1 on the diagonal, the other blocks should be B, C and D like in the picture. But the size of each block should be equal.

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Feb 27, 2015 at 18:58 If you put A in a box you can use its size in the other three quadrants:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\sbox0{\begin{matrix}1&2&3\\0&1&1\\0&0&1\end{matrix}} % C=\left[ \begin{array}{c|c} \usebox{0}&\makebox[\wd0]{\large B}\\ \hline \vphantom{\usebox{0}}\makebox[\wd0]{\large C}&\makebox[\wd0]{\large D} \end{array} \right]$
\end{document}


Here is a solution with {bNiceArray} of nicematrix.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

$M = \begin{bNiceArray}{ccc|ccc}[margin,columns-width=auto] 1 & 2 & 3 & \Block{3-3}<\Large>{B} & & \\ 0 & 1 & 1 \\ 0 & 0 & 1 \\ \hline \Block{3-3}<\Large>{C} & & & \Block{3-3}<\Large>{D} & & \\ \\ \\ \end{bNiceArray}$

\end{document} 