Best Way to Write Matrix with Dimensions on Top and Left

matrices

I'm trying to show that matrix A (m rows, n columns) times matrix B(n rows, k columns), results as matrix C ( m rows, k columns).

enter image description here

I wonder what's the easier way to write it?

there are several posts here, I found Block matrix equation with dimensioning and Equation with Large Matrix Dimension a bit too complex, while Matrix decomposition dimensions diagram put the dimensions at the bottom of the matrix, while I hope this can be displayed on the left and top.

Best Answer

I would suggest writing something more traditional and clear:

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
  \underset{(m \times n)}{A} \times \underset{(n \times k)}{B} =
    \underset{(m \times k)}{C}
\]
\end{document}
Related Question