[Tex/LaTex] Labeling rows/columns of a matrix with text and braces

bracesmath-modematrices

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}   \]

enter image description here

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.

Best Answer

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

enter image description here

\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:

enter image description here

\[
  \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}
\]