TOPICS
Search

Block Diagonal Matrix


A block diagonal matrix, also called a diagonal block matrix, is a square diagonal matrix in which the diagonal elements are square matrices of any size (possibly even 1×1), and the off-diagonal elements are 0. A block diagonal matrix is therefore a block matrix in which the blocks off the diagonal are the zero matrices, and the diagonal matrices are square.

Block diagonal matrices can be constructed out of submatrices in the Wolfram Language using the following code snippet:

  BlockDiagonalMatrix[b : {__?MatrixQ}] :=
    Module[{r, c, n = Length[b], i, j},
      {r, c} = Transpose[Dimensions /@ b];
      ArrayFlatten[
        Table[If[i == j,
          b[[i]],
          ConstantArray[0, {r[[i]], c[[j]]}]],
          {i, n}, {j, n}
        ]
      ]
    ]

See also

Block Matrix, Cayley-Hamilton Theorem, Diagonal Matrix, Direct Sum, Jordan Canonical Form, Linear Transformation, Matrix, Matrix Direct Sum

Portions of this entry contributed by Todd Rowland

Explore with Wolfram|Alpha

Cite this as:

Rowland, Todd and Weisstein, Eric W. "Block Diagonal Matrix." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/BlockDiagonalMatrix.html

Subject classifications