As suggested in other answers, it's better to use some shorthands.
\documentclass{article}
\usepackage{amsmath}
\newcommand{\minor}[4]{%
\begin{vmatrix} a_{#1} & a_{#2} \\ a_{#3} & a_{#4} \end{vmatrix}
}
\begin{document}
\[
\operatorname{adj}
\begin{pmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33}
\end{pmatrix}
=
\begin{pmatrix}
+\minor{22}{23}{32}{33} & -\minor{12}{13}{32}{33} & +\minor{12}{13}{22}{23}
\\ \noalign{\vspace{1ex}}
-\minor{21}{23}{31}{33} & +\minor{11}{13}{31}{33} & -\minor{11}{13}{21}{23}
\\ \noalign{\vspace{1ex}}
+\minor{21}{22}{31}{32} & -\minor{11}{12}{31}{32} & +\minor{11}{12}{21}{22}
\end{pmatrix}
\]
\end{document}

The challenge is now to make TeX compute the adjoint itself. Here's a set of macros tha do it.
\documentclass{article}
\usepackage{amsmath,xparse}
\ExplSyntaxOn
\NewDocumentCommand{\adjointmatrix}{O{a}m}
{% #1 = entry, #2 = number of rows
\tl_clear:N \l__amela_matrix_body_tl
\__amela_matrix_adjoint_make:nn { #1 } { #2 }
\begin{pmatrix}
\tl_use:N \l__amela_matrix_body_tl
\end{pmatrix}
}
\cs_new_protected:Nn \__amela_matrix_adjoint_make:nn
{
\int_step_inline:nn { #2 }
{
\int_step_inline:nn { #2 }
{
\int_compare:nF { ####1 = 1 } { \tl_put_right:Nn \l__amela_matrix_body_tl { & } }
\tl_put_right:Nx \l__amela_matrix_body_tl
{
\int_if_odd:nTF { ##1+####1 } { - } { + }
}
\tl_put_right:Nn \l__amela_matrix_body_tl { \begin{vmatrix} }
\__amela_matrix_adjoint_minor:nnnn { #1 } { #2 } { ####1 } { ##1 }
\tl_put_right:Nn \l__amela_matrix_body_tl { \end{vmatrix} }
}
\int_compare:nT { ##1 < #2 }
{
\tl_put_right:Nn \l__amela_matrix_body_tl { \\ \noalign{\vspace{1ex}} }
}
}
}
\cs_new_protected:Nn \__amela_matrix_adjoint_minor:nnnn
{% #1 = entry, #2 = size, #3 = row index, #4 = column index
\tl_clear:N \l__amela_matrix_minor_body_tl
\int_step_inline:nn { #2 }
{
\int_compare:nF { ##1 = #3 }
{
\tl_put_right:Nn \l__amela_matrix_minor_body_tl { \use_none:n } % remove the initial &
\int_step_inline:nn { #2 }
{
\int_compare:nF { ####1 = #4 }
{
\tl_put_right:Nn \l__amela_matrix_minor_body_tl { & #1\sb{##1####1} }
}
}
\tl_put_right:Nn \l__amela_matrix_minor_body_tl { \\ }
}
}
\tl_put_right:NV \l__amela_matrix_body_tl \l__amela_matrix_minor_body_tl
}
\NewDocumentCommand{\squarematrix}{O{a}m}
{% #1 = entry, #2 = number of rows
\tl_clear:N \l__amela_matrix_body_tl
\__amela_matrix_make:nn { #1 } { #2 }
\begin{pmatrix}
\tl_use:N \l__amela_matrix_body_tl
\end{pmatrix}
}
\tl_new:N \l__amela_matrix_body_tl
\tl_new:N \l__amela_matrix_minor_body_tl
\cs_new_protected:Nn \__amela_matrix_make:nn
{
\int_step_inline:nn { #2 }
{
\int_step_inline:nn { #2 }
{
\int_compare:nF { ####1 = 1 } { \tl_put_right:Nn \l__amela_matrix_body_tl { & } }
\tl_put_right:Nn \l__amela_matrix_body_tl { #1\sb{##1 ####1} }
}
\tl_put_right:Nn \l__amela_matrix_body_tl { \\ }
}
}
\ExplSyntaxOff
\begin{document}
\[
\squarematrix{3} \squarematrix[b]{4}
\]
\[
\operatorname{adj}\squarematrix{3}=\adjointmatrix{3}
\]
\[
\operatorname{adj}\squarematrix{2}=\adjointmatrix{2}
\]
\[
\adjointmatrix[b]{4}
\]
\end{document}

This is the output of \adjointmatrix{5} (you need large paper size for it).
