# underbrace matrix inside brackets

I would like to put an underbrace below the matrix like this:

$$\left(\underbrace{ \left[\begin{array}{ccc} a&b&c\\ d&e&f\\ g&h&i \end{array}\right]}_{A} \left[\begin{array}{c} x_1\\ x_2\\ x_3 \end{array}\right]\right)$$ But I don't want the outer brackets \left( and \right) to stretch vertically. I want them to remain as if there was no underbrace. How to achieve that behaviour?

• It is always recommended to avoid the $$...$$ syntax: please, have a look to Why is [ … ] preferable to $$…$$? for reference. – Claudio Fiandrino Jun 2 '14 at 13:34
• I almost always use the equation environment anyway, I just put $$...$$ for this example. However I didn't know that, thanks! – Rob Jun 2 '14 at 13:39

## 4 Answers

You could \smash the underbrace. Of course, you may have to add some \vspace after the equation to compensate for the underbrace that is perceived to be of zero height.

Note that, with this usage, the whole matrix is actually smashed. But because there follows a vector of identical height, the outer parens are properly sized.

\documentclass{article}
\begin{document}
$$\left(\smash{\underbrace{ \left[\begin{array}{ccc} a&b&c\\ d&e&f\\ g&h&i \end{array}\right]}_{A}} \left[\begin{array}{c} x_1\\ x_2\\ x_3 \end{array}\right]\right)$$
\end{document} • It's a long time ago since I accepted this answer, but anyway... I defined this new command \newcommand{\smashedunderbrace}{\smash{\underbrace{#1}_{#2}}\vphantom{#1}} in order to size the outer brackets correctly, even if the vector has a smaller size or is not there at all. Works well! Usage: \smashedunderbrace{what should be underbraced}{underbrace text} – Rob Mar 30 '15 at 14:00
• @Rob That's the hang of it! Thanks for the update. – Steven B. Segletes Mar 30 '15 at 14:09
• @MaK You are welcome. Note you will need to add some subsequent \vspace, since the underbrace was \smashed. – Steven B. Segletes Jun 21 '16 at 11:11

Most of the time \left and \right make delimiters that are too large for my tastes so I almost always use the amsmath versions of \big, \Big, \bigg and \Bigg.

In your example

$$\Bigg(\underbrace{ \left[\begin{array}{ccc} a&b&c\\ d&e&f\\ g&h&i \end{array}\right]}_{A} \left[\begin{array}{c} x_1\\ x_2\\ x_3 \end{array}\right]\Bigg)$$


looks OK. You'll need \usepackage{amsmath} to get the best effects. See About big parenthesis larger than Bigg if you want to make your own custom sizes. For example, I sometimes use:

\newcommand\Bigger{\left#2\rule{0mm}{#1truemm}\right.}


By default this creates a 7mm high delimiter but \Bigger( makes a 10mm bracket etc.

• Thanks! Well you replace the outer left and right bracket with fixed sized ones. Actually I would prefer another solution which keeps variable brackets. – Rob Jun 2 '14 at 12:53

Take the \left( inside the underbrace. Then you need \right. and \left. to close and open the brace.

Code:

$$\underbrace{\left( \left[\begin{array}{ccc} a&b&c\\ d&e&f\\ g&h&i \end{array}\right]\right.}_{A} \left.\left[\begin{array}{c} x_1\\ x_2\\ x_3 \end{array}\right]\right)$$

• Thanks, but that looks ugly. I don't want the underbrace to include the outer left bracket. – Rob Jun 2 '14 at 12:46

Sometimes it's simpler just to create a local definition.

## Code

\documentclass{article}

\begin{document}

Let
$A = \left[\begin{array}{ccc} a&b&c\\ d&e&f\\ g&h&i \end{array}\right]$
in
$A\left[\begin{array}{c} x_1\\ x_2\\ x_3 \end{array}\right]$

\end{document}


## Output • I want the reader to notice A in my equation which is much longer than my example. A has already been defined previously. – Rob Jun 2 '14 at 13:29