# Labeling rows/columns of a matrix with text and braces

I would like to label rows and columns of my matrix with formulas and text. I've started with a version using bordermatrix.

$\underbrace{ \bordermatrix{ & \underset{\downarrow}{x} & \underset{\downarrow}{c} \cr (17') \rightarrow & \dfrac{n}{\eta \cdot \delta} & \dfrac{1}{\lambda} \cr (16') \rightarrow & \dfrac{1-s_R}{\delta} & - \dfrac{\frac{\lambda-1}{\lambda}}{\rho + \frac{n}{\eta} - n} } }_{\text{coefficient matrix } \Delta} \cdot \begin{pmatrix} \widetilde{x} \\ \widetilde{c} \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$


But furthermore I need to

• only apply the 1 big underbrace for the main matrix
• apply similar braces for single rows and columns (additional or instead of the rightarrow/downarrow)

Thank you very much for advice.

Here is one option using \bordermatrix that provides what you're after:

\documentclass{article}

\usepackage{mathtools}

\begin{document}
$\phantom{(17') \rightarrow\hspace{\arraycolsep}}% For correct horizontal spacing within display math \[ ...$
\underbrace{
\bordermatrix{\hspace{-\arraycolsep} &
\overbrace{\hphantom{\dfrac{1-s_R}{\delta}}}^{x} &
\overbrace{\hphantom{- \dfrac{\frac{\lambda-1}{\lambda}}{\rho + \frac{n}{\eta} - n}}}^{c} \cr
\hspace{-\arraycolsep}\mathllap{(17') \rightarrow} & \dfrac{n}{\eta \cdot \delta} & \dfrac{1}{\lambda}   \cr
\hspace{-\arraycolsep}\mathllap{(16') \rightarrow} & \dfrac{1-s_R}{\delta} & - \dfrac{\frac{\lambda-1}{\lambda}}{\rho + \frac{n}{\eta} - n}
}
}_{\text{coefficient matrix $\Delta$}}
\cdot
\begin{pmatrix}
\widetilde{x} \\
\widetilde{c}
\end{pmatrix} =
\begin{pmatrix}
1 \\ 0
\end{pmatrix}
\]

\end{document}


\overbraces are stretched to the widest element in each column using \hphantom, while care is taken to remove the left-most row indices from the \underbrace yet restoring their horizontal space outside of the \bordermatrix construction.

For having left braces to identify/mark the rows, you could use the following:

$\phantom{(17') \left\{\vphantom{\dfrac{n}{\eta \cdot \delta}}\right.\hspace{\dimexpr\arraycolsep-\nulldelimiterspace}}% For correct horizontal spacing within display math \[ ...$
\underbrace{
\bordermatrix{\hspace{-\arraycolsep} &
\overbrace{\hphantom{\dfrac{1-s_R}{\delta}}}^{x} &
\overbrace{\hphantom{- \dfrac{\frac{\lambda-1}{\lambda}}{\rho + \frac{n}{\eta} - n}}}^{c} \cr
\hspace{-\arraycolsep}\mathllap{(17') \left\{\vphantom{\dfrac{n}{\eta \cdot \delta}}\right.\kern-\nulldelimiterspace} &
\dfrac{n}{\eta \cdot \delta} & \dfrac{1}{\lambda}   \cr
\hspace{-\arraycolsep}\mathllap{(16') \left\{\vphantom{- \dfrac{\frac{\lambda-1}{\lambda}}{\rho + \frac{n}{\eta} - n}}\right.\kern-\nulldelimiterspace} &
\dfrac{1-s_R}{\delta} & - \dfrac{\frac{\lambda-1}{\lambda}}{\rho + \frac{n}{\eta} - n}
}
}_{\text{coefficient matrix $\Delta$}}
\cdot
\begin{pmatrix}
\widetilde{x} \\
\widetilde{c}
\end{pmatrix} =
\begin{pmatrix}
1 \\ 0
\end{pmatrix}
\]

• Wow ok, this looks good for the colomns. It will take me some time to bring those phantom-braces to the rows :)
– Mac
Mar 8, 2016 at 21:14
• @Mac: See my updated answer...
– Werner
Mar 8, 2016 at 21:21
• Wow perfect, this even troubles me with more headache :) If I copy your code the lower big brace doesn't fit yet, and I need some time to figure out the problem. But the left and upper braces are perfect.
– Mac
Mar 8, 2016 at 21:29
• Sorry my mistake, my current .tex file missed the mathtools packages. Now everything is fine and the learning process will begin :) thx
– Mac
Mar 8, 2016 at 21:32