[Tex/LaTex] How to put more than one side braces for a vector

bracesvector

This code gives a single side brace for the vector (shown in black in image below).How can I modify this code to get two side braces (as shown in pink picture below) instead of single

enter image description here

    $${\bf x} = \left.\left( 
                                  \begin{array}{c}
                                         x_1\\
                                         \vdots\\
                                         x_{n_1}\\
                                         x_{n_1+1}\\
                                         \vdots\\
                                         x_n
                                  \end{array}
                            \right)
                        \right\}n
$$

Best Answer

There may be easier ways, but here it is with stacks.

\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\stackMath
\begin{document}
\[
{\bf x} = \left( 
                                  \begin{array}{c}
                                         x_1\\
                                         \vdots\\
                                         x_{n_1}\\
                                         x_{n_1+1}\\
                                         \vdots\\
                                         x_n
                                  \end{array}
                            \right)
\setstackgap{L}{1.2\normalbaselineskip}
\vcenter{\hbox{\stackunder[1pt]{%
  \left.{\Centerstack{\\ \\}}\right\}n_1%
}{
  \left.{\Centerstack{\\ \\}}\right\}n_2%
}}}
\]
\end{document}

enter image description here

If the braces need to be asymmetric:

\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\stackMath
\begin{document}
\[
{\bf x} = \left( 
                                  \begin{array}{c}
                                         x_1\\[-6pt]
                                         \vdots\\[-6pt]
                                         x_{n_1}\\
                                         x_{n_1+1}\\[6pt]
                                         \vdots\\[6pt]
                                         x_n
                                  \end{array}
                            \right)
\setstackgap{L}{1.2\normalbaselineskip}
\vcenter{\hbox{\stackunder[2pt]{%
  \left.{\Centerstack{\\}}\right\}n_1%
}{
  \left.{\Centerstack{\\ \\ \\}}\right\}n_2%
}}}
\]
\end{document}

enter image description here