# Typesetting a band diagonal matrix [duplicate]

Is there a way to typeset the following matrix in LaTeX?

In my attempt, I got to the following:

$$C=\left[\begin{array}{cccccccccc} 1 & 1 & 1 & 0 & \ldots & \ldots & -1 & -1 & -1\\ 1 & 1 & 1 & 1 & \ldots & \ldots & \ldots & -1 & -1\\ 1 & 1 & \ldots & 1 & 1 & \ldots & \ldots & 0 & -1\\ 0 & 1 & \ldots & \ldots & 1 & 1 & \ldots & 0 & 0\\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ \hdotsfor{9}\cr\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots &\vdots &\vdots \\ -1 &0 & \ldots & \ldots & 0 & 1 & 1 & 1 & 1\\ -1 & -1 & 0 & \ldots & \ldots & 0 & 1 & 1 & 1\\ -1 & -1 & -1 & \ldots & \ldots & \ldots & 0 & 1 & 1 \end{array} \right]$$


Would like to know how to add the curly braces.

## marked as duplicate by user36296, Werner, Stefan Pinnow, user121799, Phelype OleinikOct 3 '18 at 19:53

You can take as preview this example.

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\begin{equation*}
\underbrace{%
\begin{bmatrix}
1  & 1 & 0 & 0 & 0 & 3& 0 \\
1 & 1 & 1 & 3 & 0 & 0 & 0 \\
1 & 1 & 4 & 4 & 3 & 0 & 0 \\
0 & -1 & 4 & 3& 3 & -1 & 0 \\
0 & 0 & 4 & 4 & 3 & 16 & -1 \\
0 & 0 & 4 & & 4 & 0 & 6 \\
0 & 0 & 0 & 0 & 0 & 2 & 4 \\
\end{bmatrix}
}_{\mathrm{bla\,\,bla\,\, bla}}
\end{equation*}

\end{document}


or see at the link braces over matrix.