# Produce matrix with labels underneath

Sorry if this has been asked before, I am trying to produce a matrix that appears as in the linked image. In particular, I am wondering how to get the labels on the top and bottom of the matrices, as well as the dots indicating continuation in the matrix contents

• With all respect, if you google for singular value decomposition, you will find out that nobody types out these matrices as such since being a unitary matrix cannot be depicted visually. However you can also use \underbrace{\begin{pmatrix}...\end{pmatrix} }_{V_T} to distinguish different elements. You can try partitioning U,S,V matrices and show the reduced SVD with those partitioned matrices. Commented Jun 3, 2012 at 21:17
• You will probably find some help here or here Commented Jun 3, 2012 at 21:19
• Commented Jun 3, 2012 at 21:19
• The dots are entered as the contents of a cell with \vdots for vertical dots, \cdots for centred dots, and \ddots for diagonal dots. Commented Jun 3, 2012 at 21:29

If not closed, then this might as well have an answer. Here are a few ways of producing, for example, the second matrix above:

\documentclass{article}
\usepackage{blkarray}
\usepackage{amsmath}
\begin{document}
$\begin{blockarray}{ccc} & U &\\ \begin{block}{[ccc]} u_{1,1} & \cdots & u_{1,r}\\ \vdots & \ddots & \vdots\\ u_{m,1} & \cdots & u_{m,r}\\ \end{block} & m\times r& \\ \end{blockarray}$
$\begin{array}{c} U\\ \left[\begin{array}{ccc} u_{1,1} & \cdots & u_{1,r}\\ \vdots & \ddots & \vdots\\ u_{m,1} & \cdots & u_{m,r}\\ \end{array}\right]\\ m\times r \end{array}$
$\begin{array}{c} U\\ \begin{bmatrix} u_{1,1} & \cdots & u_{1,r}\\ \vdots & \ddots & \vdots\\ u_{m,1} & \cdots & u_{m,r}\\ \end{bmatrix}\\ m\times r \end{array}$


Which give, respectively:

To my eye, the third option produces the best spacing. However, the second two methods work only by virtue of the underset and overset text being in the center column. If it were in a different column, then the first method might be modified to give better spacing, or one of the answers linked in the comments might be preferable.

With {pNiceMatrix} of nicematrix.

\documentclass{article}
\usepackage{nicematrix}
\NiceMatrixOptions
{
code-for-first-row = \small ,
code-for-last-row = \small ,
xdots/shorten = 6pt
}

\begin{document}

$\begin{pNiceMatrix}[first-row,last-row] \Block{1-*}{U} \\ u_{11} & \Cdots & u_{1r} \\ \Vdots & \Ddots \\ u_{m1} & & u_{mr} \\ \Block{1-*}{m \times r} \end{pNiceMatrix}$

\end{document}