I was trying to explain the identity matrix over at Math StackExchange and I wound up using the following.
$${\bf I_n} = \underbrace{
\left.\left(
\begin{array}{ccccc}
1&0&0&\cdots &0\\
0&1&0&\cdots &0\\
0&0&1&\cdots &0\\
\vdots&&&\ddots&\\
0&0&0&\cdots &1
\end{array}
\right)\right\}
}_{n\text{ columns}}
\,n\text{ rows}
$$
It came out alright, but not quite what I wanted:
I'd like to be able to move the ends of the underbrace inside the parenthesis without having it turn into this:
Now, I see there are a couple of similar questions on here (examples: 1 2) which deal with the same issue. However, all of them use a bunch of fancy stuff which I can't use in online forum TeX.
Is there a way to enclose a matrix in braces using only commands available in MathJax?
I am not sure exactly which commands these are, but I am guessing a good rule of thumb would be the simplest commands possible.