Tutorials › Linear Algebra › Dimension Rules For Block Matrix Products

Matrix Operations and Algebra · Tutorial 78 of 1000

Dimension Rules For Block Matrix Products

Match the inner block dimensions to decide when block multiplication works and identify the dimensions of every block in the result.

Beginner 9 min read

What You'll Learn

  • Check ordinary matrix-product compatibility separately from block-partition compatibility.
  • Match the column widths of the first factor with the row heights of the second.
  • Determine the row and column partitions of a block product.
  • Use a common refinement to align incompatible partitions when the full product is defined.
  • Identify why matching the number of blocks alone is not enough.

Two Dimension Checks for a Block Product

Partitioning a matrix into blocks lets us treat rectangular groups of entries as units. But the blocks in two factors must fit together in a specific way before they can be multiplied block by block. There are two checks to keep separate: whether the full matrices can be multiplied at all, and whether the chosen block partitions line up for block multiplication.

Throughout, the matrices have real entries. A block is itself a matrix, so its size matters: a block with \(r\) rows and \(s\) columns is an \(r\times s\) matrix. Recall that an ordinary product \(\mathbf{A}\mathbf{B}\) is defined when the number of columns of \(\mathbf{A}\) equals the number of rows of \(\mathbf{B}\). Block multiplication imposes an additional requirement: the column widths of the blocks in \(\mathbf{A}\) must match the row heights of the blocks in \(\mathbf{B}\), in order.

Definition: Suppose \(\mathbf{A}\) is partitioned into block rows of heights \(r_1,\dots,r_m\) and block columns of widths \(s_1,\dots,s_k\). Suppose \(\mathbf{B}\) is partitioned into block rows of heights \(t_1,\dots,t_q\) and block columns of widths \(u_1,\dots,u_n\). The partitions are compatible for block multiplication when \(k=q\) and \(s_j=t_j\) for every \(j=1,\dots,k\). In that case the product has \(m\) block rows, with heights \(r_1,\dots,r_m\), and \(n\) block columns, with widths \(u_1,\dots,u_n\).

The condition \(k=q\) says the two inner partitions have the same number of blocks. The conditions \(s_j=t_j\) say that the corresponding block dimensions match, not merely that the totals match. If the partitions are compatible, every block product used in forming the result has a defined matrix product. The output block in position \((i,\ell)\) has \(r_i\) rows and \(u_\ell\) columns.

A Dimension Rule for the Output Layout

Theorem (Block-product dimension rule): Let \(\mathbf{A}\) and \(\mathbf{B}\) have compatible block partitions as defined above. Their ordinary matrix product is defined, and its block layout has the row heights of \(\mathbf{A}\) and the column widths of \(\mathbf{B}\). In particular, its block in position \((i,\ell)\) has size \(r_i\times u_\ell\).

Proof. Since the block column widths of \(\mathbf{A}\) are \(s_1,\dots,s_k\), its total number of columns is \(s_1+\cdots+s_k\). The block row heights of \(\mathbf{B}\) are \(t_1,\dots,t_k\), so its total number of rows is \(t_1+\cdots+t_k\). Compatibility gives \(s_j=t_j\) for each \(j\), and therefore the two totals are equal. Thus the ordinary product \(\mathbf{A}\mathbf{B}\) is defined. In that product, rows are grouped according to the row groups of \(\mathbf{A}\), so block row \(i\) has height \(r_i\). Columns are grouped according to the column groups of \(\mathbf{B}\), so block column \(\ell\) has width \(u_\ell\). Their intersection, the output block in position \((i,\ell)\), consequently has \(r_i\) rows and \(u_\ell\) columns. \(\square\)

This theorem gives the layout without requiring any entries of the product to be calculated. It also explains the central bookkeeping rule: the outer block partitions determine the output. The row partition comes from the first factor, and the column partition comes from the second.

Worked Example: A Compatible Product with Three Inner Blocks

Suppose \(\mathbf{A}\) has block row heights \((2,3)\) and block column widths \((2,1,2)\). Suppose \(\mathbf{B}\) has block row heights \((2,1,2)\) and block column widths \((3,2)\). Determine whether block multiplication is dimensionally compatible and give the size of each output block.

The inner block counts are both \(3\). Compare the corresponding dimensions in order:

$$ \begin{array}{c|ccc} \text{Block column of }\mathbf{A} & 1 & 2 & 3\\ \text{Width} & 2 & 1 & 2\\ \text{Corresponding block row of }\mathbf{B} & 1 & 2 & 3\\ \text{Height} & 2 & 1 & 2 \end{array} $$

All three pairs match, so the partitions are compatible. The first factor has total size \((2+3)\times(2+1+2)=5\times5\), and the second has total size \((2+1+2)\times(3+2)=5\times5\). The ordinary product is therefore defined as well.

The result inherits row heights \((2,3)\) and column widths \((3,2)\), so its block layout and block sizes are

$$ \begin{bmatrix} \mathbf{C}_{11}\;(2\times3) & \mathbf{C}_{12}\;(2\times2)\\ \mathbf{C}_{21}\;(3\times3) & \mathbf{C}_{22}\;(3\times2) \end{bmatrix}. $$

Check: the output has total size \((2+3)\times(3+2)=5\times5\), as required for the product of a \(5\times5\) matrix with a \(5\times5\) matrix. Each displayed block has the height of its block row and the width of its block column.

When the Full Product Exists but the Blocks Do Not Line Up

An ordinary product can be defined even when the given block partitions are not compatible. In that situation, the obstacle is not the overall matrix dimensions. It is that the chosen internal boundaries do not match. Sometimes the partitions can be refined—that is, split into smaller blocks—until the boundaries agree.

Theorem (Common refinement of inner partitions): Suppose the number of columns of \(\mathbf{A}\) equals the number of rows of \(\mathbf{B}\), and both inner dimensions are partitioned into blocks of positive size. There is a common refinement of the two inner partitions: split blocks so that the refined block widths of \(\mathbf{A}\) equal, in order, the refined block heights of \(\mathbf{B}\).

Proof. Let the shared inner dimension be \(N\). Describe each partition by its boundary positions among \(0,1,\dots,N\), including \(0\) and \(N\). For example, block sizes \((2,3)\) give boundaries \(0,2,5\). Take the union of the boundary positions from the two partitions and list its distinct elements in increasing order. Consecutive positions in this list define positive block sizes, since distinct consecutive positions differ by at least \(1\). Every new interval lies within an original block of each partition: no original boundary lies strictly inside one of the intervals, because all original boundaries were included in the union. Thus each original block can be split at the new boundaries, and both partitions become the same sequence of interval lengths. These common block sizes give the required refinement. \(\square\)

Worked Example: Refining Two Different Inner Partitions

Let \(\mathbf{A}\) have size \(4\times6\), with row heights \((1,3)\) and column widths \((2,4)\). Let \(\mathbf{B}\) have size \(6\times5\), with row heights \((3,3)\) and column widths \((2,3)\). The ordinary product is defined because both inner dimensions are \(6\). Are the displayed partitions compatible? If not, find a common refinement and the resulting block layout.

The inner block counts are both \(2\), but the corresponding sizes are \((2,4)\) and \((3,3)\). Since \(2\ne3\), the partitions are not compatible as given. To refine them, list their boundary positions: the column widths \((2,4)\) give \(0,2,6\), and the row heights \((3,3)\) give \(0,3,6\). The combined boundaries are \(0,2,3,6\), giving common block sizes \((2,1,3)\).

Split the second block column of \(\mathbf{A}\), of width \(4\), into widths \(1\) and \(3\). Split the first block row of \(\mathbf{B}\), of height \(3\), into heights \(2\) and \(1\). Both inner partitions now have sizes \((2,1,3)\), so block multiplication is dimensionally compatible.

The output keeps the row heights \((1,3)\) of \(\mathbf{A}\) and the column widths \((2,3)\) of \(\mathbf{B}\). Its layout is

$$ \begin{bmatrix} \mathbf{C}_{11}\;(1\times2) & \mathbf{C}_{12}\;(1\times3)\\ \mathbf{C}_{21}\;(3\times2) & \mathbf{C}_{22}\;(3\times3) \end{bmatrix}. $$

Check: the output size is \((1+3)\times(2+3)=4\times5\), matching the ordinary product of a \(4\times6\) matrix and a \(6\times5\) matrix. The refined inner block sizes agree term by term: \(2=2\), \(1=1\), and \(3=3\).

Compatibility Is More Than Matching Block Counts

Having the same number of inner blocks is necessary, but not sufficient. The dimensions must match in corresponding positions. Conversely, when two inner partitions have the same total size, differing boundaries can be repaired by a common refinement; the refinement does not change either full matrix or the ordinary product.

Worked Example: Same Block Count, Incompatible Dimensions

Suppose the inner block widths of \(\mathbf{A}\) are \((1,3)\), while the inner block heights of \(\mathbf{B}\) are \((2,2)\). Both partitions have two blocks, and both totals are \(4\). Decide whether the displayed partitions are compatible and, if not, give matching refined sizes.

The first pair has dimensions \(1\) and \(2\), so it does not match. The second pair has dimensions \(3\) and \(2\), so it does not match either. Equal block counts and equal totals do not make the original partitions compatible.

The boundary positions are \(0,1,4\) for \((1,3)\) and \(0,2,4\) for \((2,2)\). Their union gives \(0,1,2,4\), so the matching refined sizes are \((1,1,2)\). The block of width \(3\) in \(\mathbf{A}\) is split into widths \(1\) and \(2\); the block of height \(2\) at the start of \(\mathbf{B}\) is split into heights \(1\) and \(1\).

Check: after refinement, the corresponding dimensions are \(1=1\), \(1=1\), and \(2=2\). The total inner dimension remains \(1+1+2=4\) for each factor.

A Common Mistake and a Reliable Check

Common mistake: checking only the number of inner blocks. For the partitions \((1,3)\) and \((2,2)\), a wrong calculation might say, “There are two blocks on each side, so the block product is defined.” That conclusion ignores the dimensions of the paired blocks: the first attempted block product would have inner dimensions \(1\) and \(2\), and the second would have inner dimensions \(3\) and \(2\). Neither pair matches. The correction is to compare each width with the height in the same position. If they differ but the total inner dimensions agree, find the union of boundary positions and refine before applying block multiplication.

For any proposed block product, use this order of checks:

  1. Compare the total number of columns of the first matrix with the total number of rows of the second. If they differ, the ordinary product is not defined.
  2. Compare the number of inner blocks. If the counts differ, the displayed partitions are not compatible.
  3. Compare each corresponding block width and block height. Every pair must be equal.
  4. Read the output layout from the outer partitions: first-factor block row heights, second-factor block column widths.

This separation prevents a common confusion. A failure of block compatibility does not by itself imply that the ordinary matrix product fails to exist. If the total inner dimensions agree, the ordinary product is defined; the given block divisions may simply need to be refined to make blockwise multiplication available.

Check Your Understanding

For each question, focus on the dimensions and partitions; no entries of a product need to be calculated.

  1. \(\mathbf{A}\) has block row heights \((2,1)\) and column widths \((1,3)\). \(\mathbf{B}\) has block row heights \((1,3)\) and column widths \((2,2)\). Are the partitions compatible, and what is the output block layout?
  2. Suppose the inner partitions have sizes \((2,4)\) and \((3,3)\). Find the boundary positions and a common refinement.
  3. A \(3\times5\) matrix is multiplied by a \(4\times2\) matrix. Can a refinement make the ordinary product defined? Explain using the total dimensions.
  4. If the output block row heights are \((1,3)\) and its block column widths are \((2,1,2)\), state the size of the block in position \((2,3)\) and the total size of the product.
  5. Explain why equal inner block counts do not by themselves guarantee compatibility.

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon