# Entering Matrices

The Office math ribbon has a few examples of matrices, but you might like to be able to enter a lot more kinds of matrices and enter them substantially faster. For this you can use the linear format (see Sec. 3.9). For example, a 2x2 matrix is entered by \matrix(…&…@...&…), where the ellipses are the contents of the matrix elements. As in TeX, &’s separate matrix elements. Rows are separated by @’s.

You don’t have to enter anything in the matrix elements if you’re willing to enter them explicitly later. For example to enter a 4x4 empty matrix you can type \matrix(&&&@@@). This is missing the &’s for the second through fourth rows. But the build-up machinery automatically generates a rectangular matrix with each row containing the same number of elements as the row with the maximum number of elements. So in the 4x4 \matrix(&&&@@@) case, the first row has four elements and therefore each of the three subsequent rows has four elements as well.

The matrices don’t have to be square. A six-element, single row empty matrix is entered by\matrix(&&&&&) and a five element, single column empty matrix is entered by \matrix(@@@@).

Often you want parentheses surrounding the matrices. You can enter them explicitly as in (\matrix(&&@@)), or in Office 2010, you can use TeX’s control word \pmatrix(&&@@), which is slightly faster to enter. A little later this year, I’ll update the linear format paper to include the additions that appear in Office 2010.

The maximum number of elements is 254. So you can enter a 15x15 matrix and a 127x2 matrix without error. If anyone needs larger matrices, I’d like to hear about it. We don’t want to allow arbitrarily large matrices because unrealistic test scenarios might grind the machine to a virtual halt.