\documentclass[12pt,a4paper]{article}
%------------------------------------------------------------
\usepackage{amsmath,amssymb,amsthm}
\begin{document}
\[ \begin{pmatrix}
1 &2 &0&\cdots& 0\\
3& 4 &0&\cdots& 0\\
0 & 0 &0&\cdots& 0\\
\vdots & \vdots & \vdots & \vdots\\
0 & 0 &0&\cdots& 0\\
\end{pmatrix}\]
and
\[U_k= \begin{bmatrix}
J_{k\times k} &0_{k\times (n-k)} \\
0_{(n-k)\times k}& I_{(n-k)\times (n-k)}\\
\end{bmatrix}\]
\end{document}
I want to subdivise the following two matrices
Like the following one





