# how to add caption above and alongside on Matrix

can you help me with printing Matrix like picture below? I have no idea how to add the text above and alongside to Matrix in that way, and how to add those ellipses somewhere especially for sparse matrix? much appreciated.

The following example based on the kbordermatrix package might serve as a point to start from:

\documentclass{article}
\usepackage{amsmath}
\usepackage{kbordermatrix}

\begin{document}

$\kbordermatrix{ & (2,2) & (2,3) & (2,4) \\ (2,2) & a_1 & a_2 & 0 & \cdots & 0 & a_3 & a_4 & 0 & \cdots & 0 & \cdots & 0\\ (2,3) & a_5 & 0 & a_6 & \cdots & 0 & a_7 & 0 & a_8 & \cdots & 0 & \cdots & 0 \\ & \\ &\\ &\\ &\vdots & & & & & \ddots & & & & & & \vdots \\ & \\ &\cdots & & & & & \cdots & & & & & & \cdots \\ }$

\end{document}