# Recursive block matrix

I am currently writing a document in which I need to create a matrix that looks like the picture below. What is the shortest and easiest way to do so?

-

Here I created the base image called \basefig. It is a box that has been manually centered with a \raisebox so that it will work smoothly in math mode. Then I inset two images relative to the left-top corner. The insets were scaled down versions of the original. Finally the third inset was the LL in the upper left corner.

EDITED to insert upper left element

\documentclass{article}
\usepackage{scalerel}
\usepackage[usestackEOL]{stackengine}
\setstackgap{S}{0pt}
\def\sqs{5ex}
\newsavebox\basebox
\def\bsfig{%
\sffamily%
\Shortstack{%
\makebox[\sqs]{}\rule[-1.7ex]{.2pt}{\sqs}\makebox[\sqs]{HL}\\%
\rule{9ex}{.2pt}\\%
\makebox[\sqs]{LH}\rule[-1.7ex]{.2pt}{\sqs}\makebox[\sqs]{HH}\\%
}%
}
\sbox\basebox{\bsfig}
\def\basefig{\raisebox{-.45\ht\basebox}{\usebox{\basebox}}}
\begin{document}
$\left[ \stackinset{l}{3pt}{t}{3.25pt}{\scalerel*{$\sffamily LL$}{\rule{.2pt}{0.3ex}}}{% \stackinset{l}{2pt}{t}{2pt}{\scalerel*{$\basefig$}{\rule[-.7ex]{.2pt}{1.8ex}}}{% \stackinset{l}{1pt}{t}{1pt}{\scalerel*{$\basefig$}{\rule[-1.75ex]{.2pt}{4.5ex}}}{% \basefig% }}}% \right]$
\end{document}


-
+1 I like the simplicity of this approach using your packages! –  Gonzalo Medina Jan 30 at 15:32