What Is a Submatrix?

A submatrix of a matrix is another matrix obtained by forming the intersection of certain rows and columns, or equivalently by deleting certain rows and columns. More precisely, let A be an m\times n matrix and let 1\le i_1 < i_2 < \cdots < i_p \le m and 1\le j_1 < j_2 < \cdots < j_q \le n. Then the p\times q matrix B with b_{rs} = a_{i_rj_s} is the submatrix of A comprising the elements at the intersection of the rows indexed by i_1,\dots,i_p and the columns indexed by j_1,\dots,j_q. For example, for the matrix

\notag     \begin{bmatrix} ~\fbox{1} & \fbox{2} & 3\mskip2mu \\                        ~~4 & 5 & 6\mskip2mu~ \\                        ~\fbox{7} & \fbox{8} & 9~\mskip2mu        \end{bmatrix} =     \begin{bmatrix} ~\fbox{1} & \fbox{2} & 3\mskip2mu~ \\[1pt]                        ~\fbox{4} & 5 & 6\mskip2mu~ \\                        7 & \fbox{8} & 9\mskip2mu        \end{bmatrix},

shown with four elements highlighted in two different ways,

\notag        \begin{bmatrix} 1 & 2 \\                        7 & 8 \\        \end{bmatrix}

is a submatrix (the intersection of rows 1 and 3 and columns 1 and 2, or what is left after deleting row 2 and column 3), but

\notag        \begin{bmatrix} 1 & 2 \\                        4 & 8 \\        \end{bmatrix}

is \emph{not} a submatrix.

Submatrices include the mn matrix elements and the matrix itself, but there are many of intermediate size: an m\times n matrix has (2^m-1)(2^n-1) submatrices in total (counting both square and nonsquare submatrices).

If p = q and i_k = j_k, k = 1\colon p, then B is a principal submatrix of A, which is a submatrix symmetrically located about the diagonal. If, in addition, i_k = k, k=1\colon p, then B is a leading principal submatrix of A, which is one situated in the top left corner of A.

The determinant of a square submatrix is called a minor. The Laplace expansion of the determinant expresses the determinant as a weighted sum of minors.

The Colon Notation

In various programming languages, notably MATLAB, and in numerical linear algebra, a colon notation is used to denote submatrices consisting of contiguous rows and columns.

For integers p and q we denote by p\colon q the sequence p,p+1,\dots,q. Thus i = 1\colon n is another way of writing i = 1,2,\dots,n.

We write A(p\colon q,r \colon s) for the submatrix of A comprising the intersection of rows p to q and columns r to s, that is,

A(p\colon q,r \colon s) = \begin{bmatrix}a_{pr} & \cdots & a_{ps} \\                             \vdots                & \ddots & \vdots\cr a_{qr} & \cdots & a_{qs}                              \end{bmatrix}.

We can think of A(p\colon q,r \colon s) as a projection of A using the corresponding rows and columns of the identity matrix:

\notag    A(p\colon q,r \colon s) = I(p\colon q,:) \,A \,I(:,r\colon s).

As special cases, A(k,\colon) denotes the kth row of A and A(\colon,k) the kth column of A.

Here are some examples of using the colon notation to extract submatrices in MATLAB. Rows and columns can be indexed by a range using the colon notation or by specifying the required indices in a vector. The matrix used is from the Anymatrix collection.

>> A = anymatrix('core/beta',5)
A =
     1     2     3     4     5
     2     6    12    20    30
     3    12    30    60   105
     4    20    60   140   280
     5    30   105   280   630

>> A(3:4, [2 4 5]) % Rectangular submatrix.
ans =
    12    60   105
    20   140   280

>> A(1:2,4:5)      % Square, but nonprincipal, submatrix.
ans =
     4     5
    20    30

>> A([3 5],[3 5])  % Principal submatrix.
ans =
    30   105
   105   630

Block Matrices

Submatrices are intimately associated with block matrices, which are matrices in which the elements are themselves matrices. For example, a 4\times 4 matrix A can be regarded as a block 2\times 2 matrix, where each element is a 2\times 2 submatrix of A:

\notag   A = \left[\begin{array}{cc|cc}         a_{11} & a_{12} & a_{13} & a_{14}\\         a_{21} & a_{22} & a_{23} & a_{24}\\\hline         a_{31} & a_{32} & a_{33} & a_{34}\\         a_{41} & a_{42} & a_{43} & a_{44}\\         \end{array}\right]    =  \begin{bmatrix}         A_{11} & A_{12} \\         A_{21} & A_{22}        \end{bmatrix},

where

\notag  A_{11} =   A(1\colon2,1\colon2) = \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix},

and likewise for the other three blocks.

Related Blog Posts

This article is part of the “What Is” series, available from https://nhigham.com/index-of-what-is-articles/ and in PDF form from the GitHub repository https://github.com/higham/what-is.

Leave a comment