I need to create a matrix and some overbraces on some entries at the top of the matrix like the following image(the entries are omitted)
I tried this code
$$
A_n = \begin{bmatrix}
a_1&b_{1,2}&\overbrace{0, \cdots, 0}^{N_1-1}&b_{1,S_1+1}&\overbrace{0, \cdots, 0}^{N_2-1}
\end{bmatrix}
$$
and this was the result. I don't want the overbrace to be inside the matrix
How can I do that?
$$...$$
is depreciated. tex.stackexchange.com/questions/503/why-is-preferable-to