World Library  
Flag as Inappropriate
Email this Article

Matrix multiplication


Matrix multiplication

In mathematics, matrix multiplication is a binary operation that takes a pair of matrices, and produces another matrix. Numbers such as the real or complex numbers can be multiplied according to elementary arithmetic. On the other hand, matrices are arrays of numbers, so there is no unique way to define "the" multiplication of matrices. As such, in general the term "matrix multiplication" refers to a number of different ways to multiply matrices. The key features of any matrix multiplication include: the number of rows and columns the original matrices have (called the "size", "order" or "dimension"), and specifying how the entries of the matrices generate the new matrix.

Like vectors, matrices of any size can be multiplied by scalars, which amounts to multiplying every entry of the matrix by the same number. Similar to the entrywise definition of adding or subtracting matrices, multiplication of two matrices of the same size can be defined by multiplying the corresponding entries, and this is known as the Hadamard product. Another definition is the Kronecker product of two matrices, to obtain a block matrix.

One can form many other definitions. However, the most useful definition can be motivated by linear equations and linear transformations on vectors, which have numerous applications in applied mathematics, physics, and engineering. This definition is often called the matrix product.[1][2] In words, if A is an n × m matrix and B is an m × p matrix, their matrix product AB is an n × p matrix, in which the m entries across the rows of A are multiplied with the m entries down the columns of B (the precise definition is below).

This definition is not commutative, although it still retains the associative property and is distributive over entrywise addition of matrices. The identity element of the matrix product is the identity matrix (analogous to multiplying numbers by 1), and a square matrix may have an inverse matrix (analogous to the multiplicative inverse of a number). A consequence of the matrix product is determinant multiplicativity. The matrix product is an important operation in linear transformations, matrix groups, and the theory of group representations and irreps.

Computing matrix products is both a central operation in many numerical algorithms and potentially time consuming, making it one of the most well-studied problems in numerical computing. Various algorithms have been devised for computing C = AB, especially for large matrices.

This article will use the following notational conventions: matrices are represented by capital letters in bold, e.g. A, vectors in lowercase bold, e.g. a, and entries of vectors and matrices are italic (since they are scalars), e.g. A and a. Index notation is often the clearest way to express definitions, and is used as standard in the literature. The i, j entry of matrix A is indicated by (A)ij or Aij, whereas a numerical label (not matrix entries) on a collection of matrices is subscripted only, e.g. A1, A2, etc.


  • Scalar multiplication 1
  • Matrix product (two matrices) 2
    • General definition of the matrix product 2.1
    • Illustration 2.2
    • Examples of matrix products 2.3
      • Row vector and column vector 2.3.1
      • Square matrix and column vector 2.3.2
      • Square matrices 2.3.3
      • Row vector, square matrix, and column vector 2.3.4
      • Rectangular matrices 2.3.5
    • Properties of the matrix product (two matrices) 2.4
      • All matrices 2.4.1
      • Square matrices only 2.4.2
  • Matrix product (any number) 3
    • Properties of the matrix product (any number) 3.1
    • Examples of chain multiplication 3.2
  • Operations derived from the matrix product 4
    • Powers of matrices 4.1
  • Applications of the matrix product 5
    • Linear transformations 5.1
    • Linear systems of equations 5.2
    • Group theory and representation theory 5.3
  • The inner and outer products 6
    • Inner product 6.1
    • Outer product 6.2
  • Algorithms for efficient matrix multiplication 7
    • Parallel matrix multiplication 7.1
    • Communication-avoiding and distributed algorithms 7.2
  • Other forms of multiplication 8
    • Hadamard product 8.1
    • Frobenius product 8.2
    • Kronecker product 8.3
  • See also 9
  • Notes 10
  • References 11
  • External links 12

Scalar multiplication

The simplest form of multiplication associated with matrices is scalar multiplication, which is a special case of the Kronecker product.

The left scalar multiplication of a matrix A with a scalar λ gives another matrix λA of the same size as A. The entries of λA are defined by

(\lambda \mathbf{A})_{ij} = \lambda\left(\mathbf{A}\right)_{ij}\,,


\lambda \mathbf{A} = \lambda \begin{pmatrix} A_{11} & A_{12} & \cdots & A_{1m} \\ A_{21} & A_{22} & \cdots & A_{2m} \\ \vdots & \vdots & \ddots & \vdots \\ A_{n1} & A_{n2} & \cdots & A_{nm} \\ \end{pmatrix} = \begin{pmatrix} \lambda A_{11} & \lambda A_{12} & \cdots & \lambda A_{1m} \\ \lambda A_{21} & \lambda A_{22} & \cdots & \lambda A_{2m} \\ \vdots & \vdots & \ddots & \vdots \\ \lambda A_{n1} & \lambda A_{n2} & \cdots & \lambda A_{nm} \\ \end{pmatrix}\,.

Similarly, the right scalar multiplication of a matrix A with a scalar λ is defined to be

(\mathbf{A}\lambda)_{ij} = \left(\mathbf{A}\right)_{ij} \lambda\,,


\mathbf{A}\lambda = \begin{pmatrix} A_{11} & A_{12} & \cdots & A_{1m} \\ A_{21} & A_{22} & \cdots & A_{2m} \\ \vdots & \vdots & \ddots & \vdots \\ A_{n1} & A_{n2} & \cdots & A_{nm} \\ \end{pmatrix}\lambda = \begin{pmatrix} A_{11} \lambda & A_{12} \lambda & \cdots & A_{1m} \lambda \\ A_{21} \lambda & A_{22} \lambda & \cdots & A_{2m} \lambda \\ \vdots & \vdots & \ddots & \vdots \\ A_{n1} \lambda & A_{n2} \lambda & \cdots & A_{nm} \lambda \\ \end{pmatrix}\,.

When the underlying ring is commutative, for example, the real or complex number field, these two multiplications are the same, and are simply called scalar multiplication. However, for matrices over a more general ring that are not commutative, such as the quaternions, they may not be equal.

For a real scalar and matrix:

\lambda = 2, \quad \mathbf{A} =\begin{pmatrix} a & b \\ c & d \\ \end{pmatrix}
2 \mathbf{A} = 2 \begin{pmatrix} a & b \\ c & d \\ \end{pmatrix} = \begin{pmatrix} 2 \!\cdot\! a & 2 \!\cdot\! b \\ 2 \!\cdot\! c & 2 \!\cdot\! d \\ \end{pmatrix} = \begin{pmatrix} a \!\cdot\! 2 & b \!\cdot\! 2 \\ c \!\cdot\! 2 & d \!\cdot\! 2 \\ \end{pmatrix} = \begin{pmatrix} a & b \\ c & d \\ \end{pmatrix}2= \mathbf{A}2.

For quaternion scalars and matrices:

\lambda = i, \quad \mathbf{A} = \begin{pmatrix} i & 0 \\ 0 & j \\ \end{pmatrix}
i\begin{pmatrix} i & 0 \\ 0 & j \\ \end{pmatrix} = \begin{pmatrix} i^2 & 0 \\ 0 & ij \\ \end{pmatrix} = \begin{pmatrix} -1 & 0 \\ 0 & k \\ \end{pmatrix} \ne \begin{pmatrix} -1 & 0 \\ 0 & -k \\ \end{pmatrix} = \begin{pmatrix} i^2 & 0 \\ 0 & ji \\ \end{pmatrix} = \begin{pmatrix} i & 0 \\ 0 & j \\ \end{pmatrix}i\,,

where i, j, k are the quaternion units. The non-commutativity of quaternion multiplication prevents the transition of changing ij = +k to ji = −k.

Matrix product (two matrices)

Assume two matrices are to be multiplied (the generalization to any number is discussed below).

General definition of the matrix product

Arithmetic process of multiplying numbers (solid lines) in row i in matrix A and column j in matrix B, then adding the terms (dashed lines) to obtain entry ij in the final matrix.

If A is an n × m matrix and B is an m × p matrix,

\mathbf{A}=\begin{pmatrix} A_{11} & A_{12} & \cdots & A_{1m} \\ A_{21} & A_{22} & \cdots & A_{2m} \\ \vdots & \vdots & \ddots & \vdots \\ A_{n1} & A_{n2} & \cdots & A_{nm} \\ \end{pmatrix},\quad\mathbf{B}=\begin{pmatrix} B_{11} & B_{12} & \cdots & B_{1p} \\ B_{21} & B_{22} & \cdots & B_{2p} \\ \vdots & \vdots & \ddots & \vdots \\ B_{m1} & B_{m2} & \cdots & B_{mp} \\ \end{pmatrix}

the matrix product AB (denoted without multiplication signs or dots) is defined to be the n × p matrix[3][4][5][6]

\mathbf{A}\mathbf{B} =\begin{pmatrix} \left(\mathbf{AB}\right)_{11} & \left(\mathbf{AB}\right)_{12} & \cdots & \left(\mathbf{AB}\right)_{1p} \\ \left(\mathbf{AB}\right)_{21} & \left(\mathbf{AB}\right)_{22} & \cdots & \left(\mathbf{AB}\right)_{2p} \\ \vdots & \vdots & \ddots & \vdots \\ \left(\mathbf{AB}\right)_{n1} & \left(\mathbf{AB}\right)_{n2} & \cdots & \left(\mathbf{AB}\right)_{np} \\ \end{pmatrix}

where each i, j entry is given by multiplying the entries Aik (across row i of A) by the entries Bkj (down column j of B), for k = 1, 2, ..., m, and summing the results over k:

(\mathbf{A}\mathbf{B})_{ij} = \sum_{k=1}^m A_{ik}B_{kj}\,.

Thus the product AB is defined only if the number of columns in A is equal to the number of rows in B, in this case m. Each entry may be computed one at a time. Sometimes, the summation convention is used as it is understood to sum over the repeated index k. To prevent any ambiguity, this convention will not be used in the article.

Usually the entries are numbers or expressions, but can even be matrices themselves (see block matrix). The matrix product can still be calculated exactly the same way. See below for details on how the matrix product can be calculated in terms of blocks taking the forms of rows and columns.


The figure to the right illustrates diagrammatically the product of two matrices A and B, showing how each intersection in the product matrix corresponds to a row of A and a column of B.

\overset{4\times 2 \text{ matrix}}{\begin{bmatrix} {\color{Brown}{a_{11}}} & {\color{Brown}{a_{12}}} \\ \cdot & \cdot \\ {\color{Orange}{a_{31}}} & {\color{Orange}{a_{32}}} \\ \cdot & \cdot \\ \end{bmatrix}} \overset{2\times 3\text{ matrix}}{\begin{bmatrix} \cdot & {\color{Plum}{b_{12}}} & {\color{Violet}{b_{13}}} \\ \cdot & {\color{Plum}{b_{22}}} & {\color{Violet}{b_{23}}} \\ \end{bmatrix}} = \overset{4\times 3\text{ matrix}}{\begin{bmatrix} \cdot & x_{12} & x_{13} \\ \cdot & \cdot & \cdot \\ \cdot & x_{32} & x_{33} \\ \cdot & \cdot & \cdot \\ \end{bmatrix}}

The values at the intersections marked with circles are:

\begin{align} x_{12} & = {\color{Brown}{a_{11}}}{\color{Plum}{b_{12}}} + {\color{Brown}{a_{12}}}{\color{Plum}{b_{22}}} \\ x_{13} & = {\color{Brown}{a_{11}}}{\color{Violet}{b_{13}}} + {\color{Brown}{a_{12}}}{\color{Violet}{b_{23}}} \\ x_{32} & = {\color{Orange}{a_{31}}}{\color{Plum}{b_{12}}} + {\color{Orange}{a_{32}}}{\color{Plum}{b_{22}}} \\ x_{33} & = {\color{Orange}{a_{31}}}{\color{Violet}{b_{13}}} + {\color{Orange}{a_{32}}}{\color{Violet}{b_{23}}} \end{align}

Examples of matrix products

Row vector and column vector


\mathbf{A} = \begin{pmatrix} a & b & c \end{pmatrix}\,, \quad \mathbf{B} = \begin{pmatrix} x \\ y \\ z \end{pmatrix}\,,

their matrix products are:

\mathbf{AB} = \begin{pmatrix} a & b & c \end{pmatrix} \begin{pmatrix} x \\ y \\ z \end{pmatrix} = ax + by + cz \,,


\mathbf{BA} = \begin{pmatrix} x \\ y \\ z \end{pmatrix}\begin{pmatrix} a & b & c \end{pmatrix} = \begin{pmatrix} xa & xb & xc \\ ya & yb & yc \\ za & zb & zc \end{pmatrix} \,.

Note AB and BA are two different matrices: the first is a 1 × 1 matrix while the second is a 3 × 3 matrix. Such expressions occur for real-valued Euclidean vectors in Cartesian coordinates, displayed as row and column matrices, in which case AB is the matrix form of their dot product, while BA the matrix form of their dyadic or tensor product.

Square matrix and column vector


\mathbf{A} = \begin{pmatrix} a & b & c \\ p & q & r \\ u & v & w \end{pmatrix}, \quad \mathbf{B} = \begin{pmatrix} x \\ y \\ z \end{pmatrix}\,,

their matrix product is:

\mathbf{AB} = \begin{pmatrix} a & b & c \\ p & q & r \\ u & v & w \end{pmatrix} \begin{pmatrix} x \\ y \\ z \end{pmatrix} =\begin{pmatrix} ax + by + cz \\ px + qy + rz \\ ux + vy + wz \end{pmatrix}\,,

however BA is not defined.

The product of a square matrix multiplied by a column matrix arises naturally in linear algebra; for solving linear equations and representing linear transformations. By choosing a, b, c, p, q, r, u, v, w in A appropriately, A can represent a variety of transformations such as rotations, scaling and reflections, shears, of a geometric shape in space.

Square matrices


\mathbf{A} = \begin{pmatrix} a & b & c \\ p & q & r \\ u & v & w \end{pmatrix}, \quad \mathbf{B} = \begin{pmatrix} \alpha & \beta & \gamma \\ \lambda & \mu & \nu \\ \rho & \sigma & \tau \\ \end{pmatrix}\,,

their matrix products are:

\mathbf{AB} = \begin{pmatrix} a & b & c \\ p & q & r \\ u & v & w \end{pmatrix} \begin{pmatrix} \alpha & \beta & \gamma \\ \lambda & \mu & \nu \\ \rho & \sigma & \tau \\ \end{pmatrix} =\begin{pmatrix} a\alpha + b\lambda + c\rho & a\beta + b\mu + c\sigma & a\gamma + b\nu + c\tau \\ p\alpha + q\lambda + r\rho & p\beta + q\mu + r\sigma & p\gamma + q\nu + r\tau \\ u\alpha + v\lambda + w\rho & u\beta + v\mu + w\sigma & u\gamma + v\nu + w\tau \end{pmatrix}\,,


\mathbf{BA} = \begin{pmatrix} \alpha & \beta & \gamma \\ \lambda & \mu & \nu \\ \rho & \sigma & \tau \\ \end{pmatrix} \begin{pmatrix} a & b & c \\ p & q & r \\ u & v & w \end{pmatrix} =\begin{pmatrix} \alpha a + \beta p + \gamma u & \alpha b + \beta q + \gamma v & \alpha c + \beta r + \gamma w \\ \lambda a + \mu p + \nu u & \lambda b + \mu q + \nu v & \lambda c + \mu r + \nu w \\ \rho a + \sigma p + \tau u & \rho b + \sigma q + \tau v & \rho c + \sigma r + \tau w \end{pmatrix}\,.

In this case, both products AB and BA are defined, and the entries show that AB and BA are not equal in general. Multiplying square matrices which represent linear transformations corresponds to the composite transformation (see below for details).

Row vector, square matrix, and column vector


\mathbf{A} = \begin{pmatrix} a & b & c \end{pmatrix}\,, \quad \mathbf{B} = \begin{pmatrix} \alpha & \beta & \gamma \\ \lambda & \mu & \nu \\ \rho & \sigma & \tau \\ \end{pmatrix}\,, \quad \mathbf{C} = \begin{pmatrix} x \\ y \\ z \end{pmatrix}\,,

their matrix product is:

\begin{align} \mathbf{ABC} & = \begin{pmatrix} a & b & c \end{pmatrix} \left[\begin{pmatrix} \alpha & \beta & \gamma \\ \lambda & \mu & \nu \\ \rho & \sigma & \tau \\ \end{pmatrix} \begin{pmatrix} x \\ y \\ z \end{pmatrix} \right] = \left[ \begin{pmatrix} a & b & c \end{pmatrix} \begin{pmatrix} \alpha & \beta & \gamma \\ \lambda & \mu & \nu \\ \rho & \sigma & \tau \\ \end{pmatrix} \right] \begin{pmatrix} x \\ y \\ z \end{pmatrix} \\ & = \begin{pmatrix} a & b & c \end{pmatrix}\begin{pmatrix} \alpha x + \beta y + \gamma z \\ \lambda x + \mu y + \nu z \\ \rho x + \sigma y + \tau z \\ \end{pmatrix} = \begin{pmatrix} a\alpha + b\lambda + c\rho & a\beta + b\mu + c\sigma & a\gamma + b\nu + c\tau \end{pmatrix} \begin{pmatrix} x \\ y \\ z \end{pmatrix}\\ & = a\alpha x + b\lambda x + c\rho x + a\beta y + b\mu y + c\sigma y + a\gamma z + b\nu z + c\tau z \,,\end{align}

however CBA is not defined. Note that A(BC) = (AB)C, this is one of many general properties listed below. Expressions of the form ABC occur when calculating the inner product of two vectors displayed as row and column vectors in an arbitrary coordinate system, and the metric tensor in these coordinates written as the square matrix.

Rectangular matrices


\mathbf{A} = \begin{pmatrix} a & b & c \\ x & y & z \end{pmatrix}\,, \quad \mathbf{B} = \begin{pmatrix} \alpha & \rho \\ \beta & \sigma \\ \gamma & \tau \\ \end{pmatrix}\,,

their matrix products are:

\mathbf{A}\mathbf{B} = \begin{pmatrix} a & b & c \\ x & y & z \end{pmatrix} \begin{pmatrix} \alpha & \rho \\ \beta & \sigma \\ \gamma & \tau \\ \end{pmatrix} = \begin{pmatrix} a\alpha + b\beta + c \gamma & a\rho + b\sigma + c \tau \\ x\alpha + y\beta + z \gamma & x\rho + y\sigma + z \tau \\ \end{pmatrix} \,,


\mathbf{B}\mathbf{A} = \begin{pmatrix} \alpha & \rho \\ \beta & \sigma \\ \gamma & \tau \\ \end{pmatrix}\begin{pmatrix} a & b & c \\ x & y & z \end{pmatrix} = \begin{pmatrix} \alpha a + \rho x & \alpha b + \rho y & \alpha c + \rho z \\ \beta a + \sigma x & \beta b + \sigma y & \beta c + \sigma z \\ \gamma a + \tau x & \gamma b + \tau y & \gamma c + \tau z \end{pmatrix} \,.

Properties of the matrix product (two matrices)

Analogous to numbers (elements of a field), matrices satisfy the following general properties, although there is one subtlety, due to the nature of matrix multiplication.[7][8]

All matrices

  1. Not commutative: In general:
    \mathbf{A}\mathbf{B} \neq \mathbf{B}\mathbf{A}

    because AB and BA may not be simultaneously defined, and even if they are they may still not be equal. This is contrary to ordinary multiplication of numbers. To specify the ordering of matrix multiplication in words; "pre-multiply (or left multiply) A by B" means BA, while "post-multiply (or right multiply) A by C" means AC. As long as the entries of the matrix come from a ring that has an identity, and n > 1 there is a pair of n × n noncommuting matrices over the ring. A notable exception is that the identity matrix (or any scalar multiple of it) commutes with every square matrix.

    In index notation:

    \sum_k A_{ik}B_{kj} \neq \sum_k B_{ik}A_{kj}
  2. Distributive over matrix addition:
    Left distributivity:
    \mathbf{A}(\mathbf{B} + \mathbf{C}) = \mathbf{AB} + \mathbf{AC}

    Right distributivity:

    (\mathbf{A} + \mathbf{B} )\mathbf{C} = \mathbf{AC} + \mathbf{BC}

    In index notation, these are respectively:

    \sum_k A_{ik}(B_{kj} + C_{kj}) = \sum_k A_{ik}B_{kj} + \sum_k A_{ik}C_{kj}
    \sum_k (A_{ik} + B_{ik}) C_{kj} = \sum_k A_{ik}C_{kj} + \sum_k B_{ik}C_{kj}
  3. Scalar multiplication is compatible with matrix multiplication:
    \lambda(\mathbf{AB}) = (\lambda \mathbf{A})\mathbf{B} and (\mathbf{A} \mathbf{B})\lambda=\mathbf{A}(\mathbf{B}\lambda )

    where λ is a scalar. If the entries of the matrix are real or complex numbers (or from any other commutative ring), then all four quantities are equal. More generally, all four are equal if λ belongs to the center (algebra) of the ring of entries of the matrix, because in this case λX = Xλ for all matrices X. In index notation, these are respectively:

    \lambda \sum_k (A_{ik}B_{kj}) = \sum_k ( \lambda A_{ik} ) B_{kj} = \sum_k A_{ik} ( \lambda B_{kj} )
    \sum_k (A_{ik}B_{kj}) \lambda = \sum_k ( A_{ik} \lambda ) B_{kj} = \sum_k A_{ik} ( B_{kj} \lambda )
  4. Transpose:
    (\mathbf{AB})^\mathrm{T} = \mathbf{B}^\mathrm{T}\mathbf{A}^\mathrm{T}

    where T denotes the transpose, the interchange of row i with column i in a matrix. This identity holds for any matrices over a commutative ring, but not for all rings in general. Note that A and B are reversed.

    In index notation:

    \begin{align} \left[(\mathbf{AB})^\mathrm{T}\right]_{ij}&=\left(\mathbf{AB}\right)_{ji}\\ &=\sum_k\left(\mathbf{A}\right)_{jk}\left(\mathbf{B}\right)_{ki}\\ &=\sum_k\left(\mathbf{A}^\mathrm{T}\right)_{kj}\left(\mathbf{B}^\mathrm{T}\right)_{ik}\\ &=\sum_k\left(\mathbf{B}^\mathrm{T}\right)_{ik}\left(\mathbf{A}^\mathrm{T}\right)_{kj}\\ &=\left[\left(\mathbf{B}^\mathrm{T}\right)\left(\mathbf{A}^\mathrm{T}\right)\right]_{ij} \end{align}
  5. Complex conjugate: If A and B have complex entries, then
    (\mathbf{AB})^\star = \mathbf{A}^\star\mathbf{B}^\star

    where * denotes the complex conjugate of a matrix.

    In index notation:

    \begin{align} \left[(\mathbf{AB})^\star\right]_{ij}&=\left[\sum_k\left(\mathbf{A}\right)_{ik}\left(\mathbf{B}\right)_{kj}\right]^\star\\ &=\sum_k\left(\mathbf{A}\right)^\star_{ik}\left(\mathbf{B}\right)^\star_{kj}\\ &=\sum_k\left(\mathbf{A}^\star\right)_{ik}\left(\mathbf{B}^\star\right)_{kj}\\ &=\left(\mathbf{A}^\star\mathbf{B}^\star\right)_{ij} \end{align}
  6. Conjugate transpose: If A and B have complex entries, then
    (\mathbf{AB})^\dagger = \mathbf{B}^\dagger\mathbf{A}^\dagger

    where denotes the Conjugate transpose of a matrix (complex conjugate and transposed).

    In index notation:

    \begin{align} \left[(\mathbf{AB})^\dagger\right]_{ij} &=\left[\left(\mathbf{AB}\right)^\star\right]_{ji}\\ &=\sum_k\left(\mathbf{A}^\star\right)_{jk}\left(\mathbf{B}^\star\right)_{ki}\\ &=\sum_k\left(\mathbf{A}^\dagger\right)_{kj}\left(\mathbf{B}^\dagger\right)_{ik}\\ &=\sum_k\left(\mathbf{B}^\dagger\right)_{ik}\left(\mathbf{A}^\dagger\right)_{kj}\\ &=\left[\left(\mathbf{B}^\dagger\right)\left(\mathbf{A}^\dagger\right)\right]_{ij} \end{align}
  7. Traces: The trace of a product AB is independent of the order of A and B:
    \mathrm{tr}(\mathbf{AB}) = \mathrm{tr}(\mathbf{BA})

    In index notation:

    \begin{align} \mathrm{tr}(\mathbf{AB}) &=\sum_i \sum_k A_{ik}B_{ki}\\ &=\sum_k\sum_i B_{ki}A_{ik}\\ &=\mathrm{tr}(\mathbf{BA}) \end{align}

Square matrices only

  1. Identity element: If A is a square matrix, then
    \mathbf{AI} = \mathbf{IA} = \mathbf{A}
    where I is the identity matrix of the same order.
  2. Inverse matrix: If A is a square matrix, there may be an inverse matrix A−1 of A such that
    \mathbf{A}\mathbf{A}^{-1} = \mathbf{A}^{-1}\mathbf{A} = \mathbf{I}

    If this property holds then A is an invertible matrix, if not A is a singular matrix. Moreover,

    (\mathbf{AB})^\mathrm{-1} = \mathbf{B}^\mathrm{-1}\mathbf{A}^\mathrm{-1}
  3. Determinants: When a determinant of a matrix is defined (i.e., when the underlying ring is commutative), if A and B are square matrices of the same order, the determinant of their product AB equals the product of their determinants:
    \det(\mathbf{AB}) = \det(\mathbf{A})\det(\mathbf{B})
    Since det(A) and det(B) are elements of the said commutative ring, det(A)det(B) = det(B)det(A), and so det(AB) = det(BA), even when ABBA.

Matrix product (any number)

Matrix multiplication can be extended to the case of more than two matrices, provided that for each sequential pair, their dimensions match.

The product of n matrices A1, A2, ..., An with sizes s0 × s1, s1 × s2, ..., sn − 1 × sn (where s0, s1, s2, ..., sn are all simply positive integers and the subscripts are labels corresponding to the matrices, nothing more), is the s0 × sn matrix:

\prod_{i=1}^n \mathbf{A}_i = \mathbf{A}_1\mathbf{A}_2\cdots\mathbf{A}_n \, .

In index notation:

\left(\mathbf{A}_1\mathbf{A}_2\cdots\mathbf{A}_n\right)_{i_0 i_n} = \sum_{i_1=1}^{s_1}\sum_{i_2=1}^{s_2}\cdots\sum_{i_{n-1}=1}^{s_{n-1}} \left(\mathbf{A}_1\right)_{i_0 i_1}\left(\mathbf{A}_2\right)_{i_1 i_2}\left(\mathbf{A}_3\right)_{i_2 i_3} \cdots \left(\mathbf{A}_{n-1}\right)_{i_{n-2}i_{n-1}}\left(\mathbf{A}_n\right)_{i_{n-1}i_n}

Properties of the matrix product (any number)

The same properties will hold, as long as the ordering of matrices is not changed. Some of the previous properties for more than two matrices generalize as follows.

  1. Associative:
    The matrix product is associative. If three matrices A, B, and C are respectively m × p, p × q, and q × r matrices, then there are two ways of grouping them without changing their order, and
    \mathbf{ABC} = \mathbf{A}(\mathbf{BC}) = (\mathbf{AB})\mathbf{C}

    is an m × r matrix.

    If four matrices A, B, C, and D are respectively m × p, p × q, q × r, and r × s matrices, then there are five ways of grouping them without changing their order, and

    \mathbf{ABCD} = ((\mathbf{AB})\mathbf{C})\mathbf{D}=(\mathbf{A}(\mathbf{BC}))\mathbf{D}=\mathbf{A}((\mathbf{BC})\mathbf{D})=\mathbf{A}(\mathbf{B}(\mathbf{CD}))=(\mathbf{AB})(\mathbf{CD})

    is an m × s matrix.

    In general, the number of possible ways of grouping n matrices for multiplication is equal to the (n − 1)th Catalan number
  2. Trace: The trace of a product of n matrices A1, A2, ..., An is invariant under cyclic permutations of the matrices in the product:
    \mathrm{tr}(\mathbf{A}_1\mathbf{A}_2\mathbf{A}_3\ldots\mathbf{A}_{n-2}\mathbf{A}_{n-1}\mathbf{A}_n) = \mathrm{tr}(\mathbf{A}_2\mathbf{A}_3\mathbf{A}_4\ldots\mathbf{A}_{n-1}\mathbf{A}_n\mathbf{A}_1) = \mathrm{tr}(\mathbf{A}_3\mathbf{A}_4\mathbf{A}_5\ldots\mathbf{A}_n\mathbf{A}_1\mathbf{A}_2) = \ldots
  3. Determinant: For square matrices only, the determinant of a product is the product of determinants:
    \det\left(\prod_{i=1}^n \mathbf{A}_i \right) = \prod_{i=1}^n \det\left(\mathbf{A}_i\right)

Examples of chain multiplication

Similarity transformations involving similar matrices are matrix products of the three square matrices, in the form:

\mathbf{B} = \mathbf{P}^{-1} \mathbf{A} \mathbf{P}

where P is the similarity matrix and A and B are said to be similar if this relation holds. This product appears frequently in linear algebra and applications, such as diagonalizing square matrices and the equivalence between different matrix representations of the same linear operator.

Operations derived from the matrix product

More operations on square matrices can be defined using the matrix product, such as powers and nth roots by repeated matrix products, the matrix exponential can be defined by a power series, the matrix logarithm is the inverse of matrix exponentiation, and so on.

Powers of matrices

Square matrices can be multiplied by themselves repeatedly in the same way as ordinary numbers, because they always have the same number of rows and columns. This repeated multiplication can be described as a power of the matrix, a special case of the ordinary matrix product. On the contrary, rectangular matrices do not have the same number of rows and columns so they can never be raised to a power. An n × n matrix A raised to a positive integer k is defined as

\mathbf{A}^k = \underset{k \mathrm{\, times}}{\mathbf{A}\mathbf{A}\cdots\mathbf{A}}

and the following identities hold, where λ is a scalar:

  1. Zero power:
    \mathbf{A}^0 = \mathbf{I}
    where I is the identity matrix. This is parallel to the zeroth power of any number which equals unity.
  2. Scalar multiplication:
    ( \lambda \mathbf{A} )^k = \lambda^k\mathbf{A}^k
  3. Determinant:
    \det(\mathbf{A}^k) = \det(\mathbf{A})^k

The naive computation of matrix powers is to multiply k times the matrix A to the result, starting with the identity matrix just like the scalar case. This can be improved using exponentiation by squaring, a method commonly used for scalars. For diagonalizable matrices, an even better method is to use the eigenvalue decomposition of A. Another method based on the Cayley–Hamilton theorem finds an identity using the matrices' characteristic polynomial, producing a more effective equation for Ak in which a scalar is raised to the required power, rather than an entire matrix.

A special case is the power of a diagonal matrix. Since the product of diagonal matrices amounts to simply multiplying corresponding diagonal elements together, the power k of a diagonal matrix A will have entries raised to the power. Explicitly;

\mathbf{A}^k = \begin{pmatrix} A_{11} & 0 & \cdots & 0 \\ 0 & A_{22} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & A_{nn} \end{pmatrix}^k = \begin{pmatrix} A_{11}^k & 0 & \cdots & 0 \\ 0 & A_{22}^k & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & A_{nn}^k \end{pmatrix}

meaning it is easy to raise a diagonal matrix to a power. When raising an arbitrary matrix (not necessarily a diagonal matrix) to a power, it is often helpful to exploit this property by diagonalizing the matrix first.

Applications of the matrix product

Linear transformations

Matrices offer a concise way of representing linear transformations between vector spaces, and matrix multiplication corresponds to the composition of linear transformations. The matrix product of two matrices can be defined when their entries belong to the same ring, and hence can be added and multiplied.

Let U, V, and W be vector spaces over the same field with given bases, S: VW and T: UV be linear transformations and ST: UW be their composition.

Suppose that A, B, and C are the matrices representing the transformations S, T, and ST with respect to the given bases.

Then AB = C, that is, the matrix of the composition (or the product) of linear transformations is the product of their matrices with respect to the given bases.

Linear systems of equations

A system of linear equations with the same number of equations as variables can be solved by collecting the coefficients of the equations into a square matrix, then inverting the matrix equation.

A similar procedure can be used to solve a system of linear differential equations, see also phase plane.

Group theory and representation theory

The inner and outer products

Given two column vectors a and b, the Euclidean inner product and outer product are the simplest special cases of the matrix product.[9]

Inner product

The inner product of two vectors in matrix form is equivalent to a column vector multiplied on the left by a row vector:

\begin{align} \mathbf{a}\cdot\mathbf{b} &=\mathbf{a}^\mathrm{T}\mathbf{b}\\ &=\begin{pmatrix}a_1 & a_2 & \cdots & a_n\end{pmatrix}\begin{pmatrix}b_1 \\ b_2 \\ \vdots \\ b_n\end{pmatrix}\\ &=a_1b_1+a_2b_2+\cdots+a_nb_n\\ &=\sum_{i=1}^n a_ib_i, \end{align}

where aT denotes the transpose of a.

The matrix product itself can be expressed in terms of inner product. Suppose that the first n × m matrix A is decomposed into its row vectors ai, and the second m × p matrix B into its column vectors bi:[1]

\mathbf{A} = \begin{pmatrix} A_{1 1} & A_{1 2} & \cdots & A_{1 m} \\ A_{2 1} & A_{2 2} & \cdots & A_{2 m} \\ \vdots & \vdots & \ddots & \vdots \\ A_{n 1} & A_{n 2} & \cdots & A_{n m} \end{pmatrix} = \begin{pmatrix} \mathbf{a}_1 \\ \mathbf{a}_2 \\ \vdots \\ \mathbf{a}_n \end{pmatrix},
\mathbf{B} = \begin{pmatrix} B_{1 1} & B_{1 2} & \cdots & B_{1 p} \\ B_{2 1} & B_{2 2} & \cdots & B_{2 p} \\ \vdots & \vdots & \ddots & \vdots \\ B_{m 1} & B_{m 2} & \cdots & B_{m p} \end{pmatrix} = \begin{pmatrix} \mathbf{b}_1 & \mathbf{b}_2 & \cdots & \mathbf{b}_p \end{pmatrix}


\mathbf{a}_i = \begin{pmatrix}A_{i1} & A_{i2} & \cdots & A_{im} \end{pmatrix}\,,\quad \mathbf{b}_i = \begin{pmatrix}B_{1i} \\ B_{2i} \\ \vdots \\ B_{mi}\end{pmatrix}


\mathbf{AB} = \begin{pmatrix} \mathbf{a}_1 \\ \mathbf{a}_2 \\ \vdots \\ \mathbf{a}_n \end{pmatrix} \begin{pmatrix} \mathbf{b}_1 & \mathbf{b}_2 & \dots & \mathbf{b}_p \end{pmatrix} = \begin{pmatrix} (\mathbf{a}_1 \cdot \mathbf{b}_1) & (\mathbf{a}_1 \cdot \mathbf{b}_2) & \dots & (\mathbf{a}_1 \cdot \mathbf{b}_p) \\ (\mathbf{a}_2 \cdot \mathbf{b}_1) & (\mathbf{a}_2 \cdot \mathbf{b}_2) & \dots & (\mathbf{a}_2 \cdot \mathbf{b}_p) \\ \vdots & \vdots & \ddots & \vdots \\ (\mathbf{a}_n \cdot \mathbf{b}_1) & (\mathbf{a}_n \cdot \mathbf{b}_2) & \dots & (\mathbf{a}_n \cdot \mathbf{b}_p) \end{pmatrix}

It is also possible to express a matrix product in terms of concatenations of products of matrices and row or column vectors:

\mathbf{AB} = \begin{pmatrix} \mathbf{A}\mathbf{b}_1 & \mathbf{A}\mathbf{b}_2 & \dots & \mathbf{A}\mathbf{b}_p \end{pmatrix} = \begin{pmatrix} \mathbf{a}_1\mathbf{B} \\ \mathbf{a}_2\mathbf{B}\\ \vdots\\ \mathbf{a}_n\mathbf{B} \end{pmatrix}

These decompositions are particularly useful for matrices that are envisioned as concatenations of particular types of row vectors or column vectors, e.g. orthogonal matrices (whose rows and columns are unit vectors orthogonal to each other) and Markov matrices (whose rows or columns sum to 1).

Outer product

The outer product (also known as the dyadic product or tensor product) of two vectors in matrix form is equivalent to a row vector multiplied on the left by a column vector:

\begin{align} \mathbf{a}\otimes\mathbf{b} &=\mathbf{a}\mathbf{b}^\mathrm{T}\\ &=\begin{pmatrix}a_1 \\ a_2 \\ \vdots \\ a_n\end{pmatrix} \begin{pmatrix}b_1 & b_2 & \cdots & b_n\end{pmatrix}\\ &=\begin{pmatrix} a_1 b_1 & a_1 b_2 & \cdots & a_1 b_n \\ a_2 b_1 & a_2 b_2 & \cdots & a_2 b_n \\ \vdots & \vdots & \ddots & \vdots \\ a_n b_1 & a_n b_2 & \cdots & a_n b_n \\ \end{pmatrix}. \end{align}

An alternative method is to express the matrix product in terms of the outer product. The decomposition is done the other way around, the first matrix A is decomposed into column vectors ai and the second matrix B into row vectors bi:

\begin{align} \mathbf{AB} &=\begin{pmatrix} \mathbf{\bar a}_1 & \mathbf{\bar a}_2 & \cdots & \mathbf{\bar a}_m \end{pmatrix}\begin{pmatrix} \mathbf{\bar b}_1 \\ \mathbf{\bar b}_2 \\ \vdots \\ \mathbf{\bar b}_m \end{pmatrix}\\ &=\mathbf{\bar a}_1 \otimes \mathbf{\bar b}_1 + \mathbf{\bar a}_2 \otimes \mathbf{\bar b}_2 + \cdots + \mathbf{\bar a}_m \otimes \mathbf{\bar b}_m\\ &=\sum_{i=1}^m \mathbf{\bar a}_i \otimes \mathbf{\bar b}_i \end{align}

where this time

\mathbf{\bar a}_i = \begin{pmatrix}A_{1i} \\ A_{2i} \\ \vdots \\ A_{ni} \end{pmatrix}\,,\quad \mathbf{\bar b}_i = \begin{pmatrix}B_{i1} & B_{i2} & \cdots & B_{ip}\end{pmatrix}\,.

This method emphasizes the effect of individual column/row pairs on the result, which is a useful point of view with e.g. covariance matrices, where each such pair corresponds to the effect of a single sample point.

\begin{align} \begin{pmatrix} {\color{Brown}1} & {\color{Orange}2} & {\color{Violet}3} \\ {\color{Brown}4} & {\color{Orange}5} & {\color{Violet}6} \\ {\color{Brown}7} & {\color{Orange}8} & {\color{Violet}9} \\ \end{pmatrix} \begin{pmatrix} {\color{Brown}a} & {\color{Brown}d} \\ {\color{Orange}b} & {\color{Orange}e} \\ {\color{Violet}c} & {\color{Violet}f} \\ \end{pmatrix} &= \begin{pmatrix} {\color{Brown}1} \\ {\color{Brown}4} \\ {\color{Brown}7} \\ \end{pmatrix} \begin{pmatrix} {\color{Brown}{a}} & {\color{Brown}{d}} \\ \end{pmatrix} + \begin{pmatrix} {\color{Orange}2} \\ {\color{Orange}5} \\ {\color{Orange}8}\\ \end{pmatrix} \begin{pmatrix} {\color{Orange}{b}} & {\color{Orange}{e}} \\ \end{pmatrix}+ \begin{pmatrix} {\color{Violet}3} \\ {\color{Violet}6} \\ {\color{Violet}9} \\ \end{pmatrix} \begin{pmatrix} {\color{Violet}c} & {\color{Violet}f} \\ \end{pmatrix} \\&= \begin{pmatrix} {\color{Brown}{1a}} & {\color{Brown}{1d}} \\ {\color{Brown}{4a}} & {\color{Brown}{4d}} \\ {\color{Brown}{7a}} & {\color{Brown}{7d}} \\ \end{pmatrix}+ \begin{pmatrix} {\color{Orange}{2b}} & {\color{Orange}{2e}} \\ {\color{Orange}{5b}} & {\color{Orange}{5e}} \\ {\color{Orange}{8b}} & {\color{Orange}{8e}} \\ \end{pmatrix}+ \begin{pmatrix} {\color{Violet}{3c}} & {\color{Violet}{3f}} \\ {\color{Violet}{6c}} & {\color{Violet}{6f}} \\ {\color{Violet}{9c}} & {\color{Violet}{9f}} \\ \end{pmatrix} \\&= \begin{pmatrix} {\color{Brown}{1a}} + {\color{Orange}{2b}} + {\color{Violet}{3c}} & {\color{Brown}{1d}} + {\color{Orange}{2e}} + {\color{Violet}{3f}} \\ {\color{Brown}{4a}} + {\color{Orange}{5b}} + {\color{Violet}{6c}} & {\color{Brown}{4d}} + {\color{Orange}{5e}} + {\color{Violet}{6f}} \\ {\color{Brown}{7a}} + {\color{Orange}{8b}} + {\color{Violet}{9c}} & {\color{Brown}{7d}} + {\color{Orange}{8e}} + {\color{Violet}{9f}} \\ \end{pmatrix}. \end{align}

Algorithms for efficient matrix multiplication

The bound on ω over time.

The running time of square matrix multiplication, if carried out naïvely, is O(n3). The running time for multiplying rectangular matrices (one m × p-matrix with one p × n-matrix) is O(mnp), however, more efficient algorithms exist, such as Strassen's algorithm, devised by Volker Strassen in 1969 and often referred to as "fast matrix multiplication". It is based on a way of multiplying two 2 × 2-matrices which requires only 7 multiplications (instead of the usual 8), at the expense of several additional addition and subtraction operations. Applying this recursively gives an algorithm with a multiplicative cost of O( n^{\log_{2}7}) \approx O(n^{2.807}). Strassen's algorithm is more complex, and the numerical stability is reduced compared to the naïve algorithm.[10] Nevertheless, it appears in several libraries, such as BLAS, where it is significantly more efficient for matrices with dimensions n > 100,[11] and is very useful for large matrices over exact domains such as finite fields, where numerical stability is not an issue.

The current O(nk) algorithm with the lowest known exponent k is a generalization of the Coppersmith–Winograd algorithm that has an asymptotic complexity of O(n2.3728639), by François Le Gall.[12] This algorithm, and the Coppersmith–Winograd algorithm on which it is based, are similar to Strassen's algorithm: a way is devised for multiplying two k × k-matrices with fewer than k3 multiplications, and this technique is applied recursively. However, the constant coefficient hidden by the Big O notation is so large that these algorithms are only worthwhile for matrices that are too large to handle on present-day computers.[13][14]

Since any algorithm for multiplying two n × n-matrices has to process all 2 × n2-entries, there is an asymptotic lower bound of Ω(n2) operations. Raz (2002) proves a lower bound of Ω(n2 log(n)) for bounded coefficient arithmetic circuits over the real or complex numbers.

Cohn et al. (2003, 2005) put methods such as the Strassen and Coppersmith–Winograd algorithms in an entirely different group-theoretic context, by utilising triples of subsets of finite groups which satisfy a disjointness property called the triple product property (TPP). They show that if families of wreath products of Abelian groups with symmetric groups realise families of subset triples with a simultaneous version of the TPP, then there are matrix multiplication algorithms with essentially quadratic complexity. Most researchers believe that this is indeed the case.[15] However, Alon, Shpilka and Chris Umans have recently shown that some of these conjectures implying fast matrix multiplication are incompatible with another plausible conjecture, the sunflower conjecture.[16]

Freivalds' algorithm is a simple Monte Carlo algorithm that given matrices A, B, C verifies in Θ(n2) time if AB = C.

Block matrix multiplication. In the 2D algorithm, each processor is responsible for one submatrix of C. In the 3D algorithm, every pair of submatrices from A and B that is multiplied is assigned to one processor.

Parallel matrix multiplication

Because of the nature of matrix operations and the layout of matrices in memory, it is typically possible to gain substantial performance gains through use of parallelization and vectorization. Several algorithms are possible, among which divide and conquer algorithms based on the block matrix decomposition

\mathbf{C} = \begin{pmatrix} \mathbf{C}_{11} & \mathbf{C}_{12} \\ \mathbf{C}_{21} & \mathbf{C}_{22} \\ \end{pmatrix} = \begin{pmatrix} \mathbf{A}_{11} & \mathbf{A}_{12} \\ \mathbf{A}_{21} & \mathbf{A}_{22} \\ \end{pmatrix} \begin{pmatrix} \mathbf{B}_{11} & \mathbf{B}_{12} \\ \mathbf{B}_{21} & \mathbf{B}_{22} \\ \end{pmatrix} = \mathbf{A} \mathbf{B}

that also underlies Strassen's algorithm. Here, A, B and C are presumed to be n by n (square) matrices, and C11 etc. are n/2 by n/2 submatrices. From this decomposition, one derives[17]

\begin{pmatrix} \mathbf{A}_{11} & \mathbf{A}_{12} \\ \mathbf{A}_{21} & \mathbf{A}_{22} \\ \end{pmatrix} \begin{pmatrix} \mathbf{B}_{11} & \mathbf{B}_{12} \\ \mathbf{B}_{21} & \mathbf{B}_{22} \\ \end{pmatrix} = \begin{pmatrix} \mathbf{A}_{11} \mathbf{B}_{11} + \mathbf{A}_{12} \mathbf{B}_{21} & \mathbf{A}_{11} \mathbf{B}_{12} + \mathbf{A}_{12} \mathbf{B}_{22}\\ \mathbf{A}_{21} \mathbf{B}_{11} + \mathbf{A}_{22} \mathbf{B}_{21} & \mathbf{A}_{21} \mathbf{B}_{12} + \mathbf{A}_{22} \mathbf{B}_{22}\\ \end{pmatrix}

which consists of eight multiplications of pairs of submatrices, which can all be performed in parallel, followed by an addition step. Applying this recursively, and performing the additions in parallel as well, one obtains an algorithm that runs in Θ(log2 n) time on an ideal machine with an infinite number of processors, and has a maximum possible speedup of Θ(n3/(log2 n)) on any real computer (although the algorithm isn't practical, a more practical variant achieves Θ(n2) speedup).[17]

It should be noted that some lower time-complexity algorithms on paper may have indirect time complexity costs on real machines.

Communication-avoiding and distributed algorithms

On modern architectures with hierarchical memory, the cost of loading and storing input matrix elements tends to dominate the cost of arithmetic. On a single machine this is the amount of data transferred between RAM and cache, while on a distributed memory multi-node machine it is the amount transferred between nodes; in either case it is called the communication bandwidth. The naïve algorithm using three nested loops uses Ω(n3) communication bandwidth.

Cannon's algorithm, also known as the 2D algorithm, partitions each input matrix into a block matrix whose elements are submatrices of size M/3 by M/3, where M is the size of fast memory.[18] The naïve algorithm is then used over the block matrices, computing products of submatrices entirely in fast memory. This reduces communication bandwidth to O(n3/M), which is asymptotically optimal (for algorithms performing Ω(n3) computation).[19][20]

In a distributed setting with p processors arranged in a p by p 2D mesh, one submatrix of the result can be assigned to each processor, and the product can be computed with each processor transmitting O(n2/p) words, which is asymptotically optimal assuming that each node stores the minimum O(n2/p) elements.[20] This can be improved by the 3D algorithm, which arranges the processors in a 3D cube mesh, assigning every product of two input submatrices to a single processor. The result submatrices are then generated by performing a reduction over each row.[21] This algorithm transmits O(n2/p2/3) words per processor, which is asymptotically optimal.[20] However, this requires replicating each input matrix element p1/3 times, and so requires a factor of p1/3 more memory than is needed to store the inputs. This algorithm can be combined with Strassen to further reduce runtime.[21] "2.5D" algorithms provide a continuous tradeoff between memory usage and communication bandwidth.[22] On modern distributed computing environments such as MapReduce, specialized multiplication algorithms have been developed.[23]

Other forms of multiplication

Some other ways to multiply two matrices are given below; some, in fact, are simpler than the definition above. The Cracovian product is yet another form.

Hadamard product

For two matrices of the same dimensions, there is the Hadamard product, also known as the element-wise product, pointwise product, entrywise product and the Schur product.[24] For two matrices A and B of the same dimensions, the Hadamard product AB is a matrix of the same dimensions, the i, j element of A is multiplied with the i, j element of B, that is:

\left(\mathbf{A} \circ \mathbf{B}\right)_{ij} = A_{ij}B_{ij}\,,

displayed fully:

\mathbf{A} \circ \mathbf{B} = \begin{pmatrix} A_{11} & A_{12} & \cdots & A_{1m} \\ A_{21} & A_{22} & \cdots & A_{2m} \\ \vdots & \vdots & \ddots & \vdots \\ A_{n1} & A_{n2} & \cdots & A_{nm} \\ \end{pmatrix}\circ\begin{pmatrix} B_{11} & B_{12} & \cdots & B_{1m} \\ B_{21} & B_{22} & \cdots & B_{2m} \\ \vdots & \vdots & \ddots & \vdots \\ B_{n1} & B_{n2} & \cdots & B_{nm} \\ \end{pmatrix} =\begin{pmatrix} A_{11}B_{11} & A_{12}B_{12} & \cdots & A_{1m}B_{1m} \\ A_{21}B_{21} & A_{22}B_{22} & \cdots & A_{2m}B_{2m} \\ \vdots & \vdots & \ddots & \vdots \\ A_{n1}B_{n1} & A_{n2}B_{n2} & \cdots & A_{nm}B_{nm} \\ \end{pmatrix}

This operation is identical to multiplying many ordinary numbers (mn of them) all at once; thus the Hadamard product is commutative, associative and distributive over entrywise addition. It is also a principal submatrix of the Kronecker product. It appears in lossy compression algorithms such as JPEG.

Frobenius product

The Frobenius inner product, sometimes denoted A : B, is the component-wise inner product of two matrices as though they are vectors. It is also the sum of the entries of the Hadamard product. Explicitly,

\mathbf{A}:\mathbf{B}=\sum_{i,j} A_{ij} B_{ij} = \mathrm{vec}(\mathbf{A})^\mathsf{T} \mathrm{vec}(\mathbf{B}) = \mathrm{tr}(\mathbf{A}^\mathsf{T} \mathbf{B}) = \mathrm{tr}(\mathbf{A} \mathbf{B}^\mathsf{T}),

where "tr" denotes the trace of a matrix and vec denotes vectorization. This inner product induces the Frobenius norm.

Kronecker product

For two matrices A and B of any different dimensions m × n and p × q respectively (no constraints on the dimensions of each matrix), the Kronecker product is the matrix

\mathbf{A} \otimes \mathbf{B} = \begin{pmatrix} A_{11}\mathbf{B} & A_{12}\mathbf{B} & \cdots & A_{1n}\mathbf{B} \\ A_{21}\mathbf{B} & A_{22}\mathbf{B} & \cdots & A_{2n}\mathbf{B} \\ \vdots & \vdots & \ddots & \vdots \\ A_{m1}\mathbf{B} & A_{m2}\mathbf{B} & \cdots & A_{mn}\mathbf{B} \\ \end{pmatrix}.

with dimensions mp × nq.[25] This is the application of the more general tensor product applied to matrices.

See also


  1. ^ a b Lerner, R. G.; Trigg, G. L. (1991). Encyclopaedia of Physics (2nd ed.). VHC publishers.  
  2. ^ Parker, C. B. (1994). McGraw Hill Encyclopaedia of Physics (2nd ed.).  
  3. ^ Lipschutz, S.; Lipson, M. (2009). Linear Algebra. Schaum's Outlines (4th ed.). McGraw Hill (USA). pp. 30–31.  
  4. ^ Riley, K. F.; Hobson, M. P.; Bence, S. J. (2010). Mathematical methods for physics and engineering. Cambridge University Press.  
  5. ^ Adams, R. A. (1995). Calculus, A Complete Course (3rd ed.). Addison Wesley. p. 627.  
  6. ^ Horn, Johnson (2013). Matrix Analysis (2nd ed.). Cambridge University Press. p. 6.  
  7. ^ Lipcshutz, S.; Lipson, M. (2009). "2". Linear Algebra. Schaum's Outlines (4th ed.). McGraw Hill (USA).  
  8. ^ Horn, Johnson (2013). "0". Matrix Analysis (2nd ed.). Cambridge University Press.  
  9. ^ Mathematical methods for physics and engineering, K.F. Riley, M.P. Hobson, S.J. Bence, Cambridge University Press, 2010, ISBN 978-0-521-86153-3
  10. ^ Miller, Webb (1975), "Computational complexity and numerical stability", SIAM News 4: 97–107,  
  11. ^ Press 2007, p. 108.
  12. ^ Le Gall, François (2014), "Powers of tensors and fast matrix multiplication", Proceedings of the 39th International Symposium on Symbolic and Algebraic Computation (ISSAC 2014),  
  13. ^ Iliopoulos, Costas S. (1989), "Worst-case complexity bounds on algorithms for computing the canonical structure of finite abelian groups and the Hermite and Smith normal forms of an integer matrix" (PDF), SIAM Journal on Computing 18 (4): 658–669,  
  14. ^ Robinson, Sara (2005), "Toward an Optimal Algorithm for Matrix Multiplication" (PDF), SIAM News 38 (9) 
  15. ^ Robinson, 2005.
  16. ^ Alon, Shpilka, Umans, On Sunflowers and Matrix Multiplication
  17. ^ a b Randall, Keith H. (1998). Cilk: Efficient Multithreaded Computing (PDF) (Ph.D.). Massachusetts Institute of Technology. pp. 54–57. 
  18. ^ Lynn Elliot Cannon, A cellular computer to implement the Kalman Filter Algorithm, Technical report, Ph.D. Thesis, Montana State University, 14 July 1969.
  19. ^ Hong, J.W.; Kung, H. T. (1981). "I/O complexity: The red-blue pebble game". STOC ’81: Proceedings of the thirteenth annual ACM symposium on Theory of computing: 326–333. 
  20. ^ a b c Irony, Dror; Toledo, Sivan; Tiskin, Alexander (September 2004). "Communication lower bounds for distributed-memory matrix multiplication". J. Parallel Distrib. Comput. 64 (9): 1017–1026.  
  21. ^ a b Agarwal, R.C.; Balle, S. M.; Gustavson, F. G.; Joshi, M.; Palkar, P. (September 1995). "A three-dimensional approach to parallel matrix multiplication". IBM J. Res. Dev. 39 (5): 575–582.  
  22. ^ Solomonik, Edgar; Demmel, James (2011). "Communication-optimal parallel 2.5D matrix multiplication and LU factorization algorithms". Proceedings of the 17th international conference on Parallel processing. Part II: 90–109.  
  23. ^ Bosagh Zadeh, Reza; Carlsson, Gunnar. "Dimension Independent Matrix Square Using MapReduce" (PDF). Retrieved 12 July 2014. 
  24. ^ (Horn & Johnson 1985, Ch. 5)
  25. ^ Steeb, Willi-Hans (1997), Matrix Calculus and Kronecker Product with Applications and C++ Programs, World Scientific, p. 55,  .


  • Henry Cohn, Robert Kleinberg, Balázs Szegedy, and Chris Umans. Group-theoretic Algorithms for Matrix Multiplication. arXiv:math.GR/0511460. Proceedings of the 46th Annual Symposium on Foundations of Computer Science, 23–25 October 2005, Pittsburgh, PA, IEEE Computer Society, pp. 379–388.
  • Henry Cohn, Chris Umans. A Group-theoretic Approach to Fast Matrix Multiplication. arXiv:math.GR/0307321. Proceedings of the 44th Annual IEEE Symposium on Foundations of Computer Science, 11–14 October 2003, Cambridge, MA, IEEE Computer Society, pp. 438–449.
  • Coppersmith, D.; Winograd, S. (1990). "Matrix multiplication via arithmetic progressions". J. Symbolic Comput 9: 251–280.  
  • Horn, Roger A.; Johnson, Charles R. (1991), Topics in Matrix Analysis,  
  • Knuth, D.E., The Art of Computer Programming Volume 2: Seminumerical Algorithms. Addison-Wesley Professional; 3 edition (November 14, 1997). ISBN 978-0-201-89684-8. pp. 501.
  • Press, William H.; Flannery, Brian P.; .  
  • Ran Raz. On the complexity of matrix product. In Proceedings of the thirty-fourth annual ACM symposium on Theory of computing. ACM Press, 2002. doi:10.1145/509907.509932.
  • Robinson, Sara, Toward an Optimal Algorithm for Matrix Multiplication, SIAM News 38(9), November 2005. PDF
  • Strassen, Volker, Gaussian Elimination is not Optimal, Numer. Math. 13, p. 354-356, 1969.
  • Styan, George P. H. (1973), "Hadamard Products and Multivariate Statistical Analysis", Linear Algebra and its Applications 6: 217–240,  
  • Vassilevska Williams, Virginia, Multiplying matrices faster than Coppersmith-Winograd, Manuscript, May 2012. PDF

External links

  • How to Multiply Matrices
  • Matrix Multiplication Calculator Online
  • The Simultaneous Triple Product Property and Group-theoretic Results for the Exponent of Matrix Multiplication
  • WIMS Online Matrix Multiplier
  • Wijesuriya, Viraj B., Daniweb: Sample Code for Matrix Multiplication using MPI Parallel Programming Approach, retrieved 2010-12-29 
  • Linear algebra: matrix operations Multiply or add matrices of a type and with coefficients you choose and see how the result was computed.
  • Matrix Multiplication in Java – Dr. P. Viry
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.