# [SOLVED] adding braces above a Matrix

• Dec 6th 2007, 01:19 AM
Gunslinger
[SOLVED] adding braces above a Matrix
Hi everyone!

I'm trying to add some braces above/below and left/right of a Matrix to describe how many Columns and Rows certain ranges of the matrix has.
For example I have a 2 by 2 Block-matrix. I want a brace over the first and the one over the second column telling me how large each blockmatrix is.
\overbrace doesn't seem to work for me because either the brace and it's description end up inside the matrix or the braces are over the brackets and the column to be braced.
Here's what I've tried sofar:

$\left[ {\begin{array}{*{20}c} 1 & 2 \\ 3 & 4 \\ \end{array}} \right] + \overbrace {\left[ {\begin{array}{*{20}c} 1 \\ 3 \\ \end{array}} \right.}^N\quad \overbrace {\left. {\begin{array}{*{20}c} 2 \\ 4 \\ \end{array}} \right]}^k\begin{array}{*{20}c} {\left. {} \right\}N}\\ {\left. {} \right\}k}\\ \end{array}$

I hope someone knows a solution to this problem.

Michael
• Dec 20th 2007, 12:05 PM
Opalg
Plain TeX has a control sequence \bordermatrix to handle this sort of thing. Unfortunately it's a bit inflexible. It only allows parenthesised matrices, and it only allows labels above and to the left, not below or to the right of the matrix. The input

$\bordermatrix{&\overbrace{}^N&\overbrace{}^k\cr \llap{{\scriptstyle N}\{}&A&B\cr \llap{{\scriptstyle k}\{}&C&D\cr}$

yields

$\bordermatrix{&\overbrace{}^N&\overbrace{}^k\cr \llap{{\scriptstyle N}\{}&A&B\cr \llap{{\scriptstyle k}\{}&C&D\cr}$ .

Note the use of \llap to justify the braces to the left of the matrix. Without this, the labels would be left justified, giving a ragged appearance.