Insertar una matriz de 2x2 en una matriz de 5x5

Insertar una matriz de 2x2 en una matriz de 5x5

Necesito insertar una matriz de 2x2 de manera uniforme en las filas 4 y 5 y en las columnas 4 y 5 de una matriz de 5x5. Mi código necesita ajustes.

\begin{equation*}
    a_1=
    \begin{bmatrix}
        1 & 0 & 0 & 0 & 0\\
        0 & 0 & 0 & 0 & 0\\
        0 & 0 & 0 & 0 & 0\\
        0 & 0 & 0 & & {\begin{bmatrix} & b & \end{bmatrix}}\\
        0 & 0 & 0 &
    \end{bmatrix}
\end{equation*}

Respuesta1

O tal vez con nicematrix. Requiere un paquete adicional (que a su vez carga otras cosas, sobre todo TikZ), sin embargo, el espacio entre las columnas no se modifica y usted tiene control total sobre todos los aspectos de la apariencia.

\documentclass{article}
\usepackage{amsmath}
\usepackage{nicematrix}
\begin{document}
\begin{equation*} 
a_1=\begin{bNiceMatrix}[name=mymatrix]
        1 & 0 & 0 & 0 & 0\\
        0 & 0 & 0 & 0 & 0\\
        0 & 0 & 0 & 0 & 0\\
        0 & 0 & 0 & \phantom{0} & \phantom{0}\\
        0 & 0 & 0 & \phantom{0} & \phantom{0}
\end{bNiceMatrix}
\begin{tikzpicture}[remember picture,overlay]
\node[fit=(mymatrix-4-4)(mymatrix-5-5),inner sep=-0.2ex,text height=1.2em] (f){$b$};
\draw[thick] ([xshift=0.5ex]f.south west)-| (f.north west) -- ++ (0.5ex,0)
([xshift=-0.5ex]f.south east)-| (f.north east) -- ++ (-0.5ex,0);
\end{tikzpicture}
\end{equation*}
\end{document}

ingrese la descripción de la imagen aquí

Respuesta2

En lugar de bmatrixpara la matriz de 2x2 que usé matrix. Pero es sólo una preferencia personal y se puede cambiar sin problemas.

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation*}
    a_1=
    \begin{bmatrix}
        \begin{matrix}  
            1 & 0 & 0\\ 
            0 & 0 & 0 \\
            0 & 0 & 0
        \end{matrix} & 
        \begin{matrix} 
            0 & 0\\
            0 & 0 \\
            0 & 0
        \end{matrix}\\
        \begin{matrix}
            0 & 0 & 0\\
            0 & 0 & 0
        \end{matrix} & 
        \begin{matrix} & b & \end{matrix}\\
    \end{bmatrix}
\end{equation*}

\end{document}

Resultado con matrix:

matriz

Resultado con bmatrix:

matriz

Respuesta3

Una solución con blkarray:

\documentclass{article}
\usepackage{multirow}
\usepackage{blkarray, bigstrut}
\usepackage{amsmath}

\begin{document}

\begin{equation*}
    a_1=
  \left[
   \begin{blockarray}{@{\,}ccccc@{\:}}
\bigstrut[t]
           1 & 0 & 0 & 0 & 0 & \\
            0 & 0 & 0 & 0 & 0 & \\
            0 & 0 & 0 & 0 & 0 & \\
        \begin{block}{@{\,}ccc[\BAmulticolumn{2}{!{}c!{}}@{\:}]}
            0 & 0 & 0 & \multirow{2}{*}{b}\\
           0 & 0 & 0 & \\
        \end{block}
\BAnoalign{\vskip -7ex}
    \end{blockarray}\right]
\end{equation*}

\end{document} 

ingrese la descripción de la imagen aquí

información relacionada