# matrix multiplication

This article gives an overview of the various ways to perform matrix multiplication.

## Ordinary matrix product

By far the most important way to multiply matrices is the usual matrix multiplication. It is defined between two matrices only if the number of columns of the first matrix is the same as the number of rows of the second matrix. If A is an m-by-n matrix and B is an n-by-p matrix, then their product is an m-by-p matrix denoted by AB (or sometimes A Â· B). The product is given by

for each pair i and j with 1 ≤ im and 1 ≤ jp. The algebraic system of "matrix units" summarises the abstract properties of this kind of multiplication.

### Calculating directly from the definition

The picture to the left shows how to calculate the (1,2) element and the (3,3) element of AB if A is a 4Ã—2 matrix, and B is a 2Ã—3 matrix. Elements from each matrix are paired off in the direction of the arrows; each pair is multiplied and the products are added. The location of the resulting number in AB corresponds to the row and column that were considered.

### The coefficients-vectors method

This matrix multiplication can also be considered from a slightly different viewpoint : it adds vectors together after being multiplied by different coefficients. If A and B are matrices given by:

and

then

For example:

The rows in the matrix on the left are the list of coefficients. The matrix on the right is the list of vectors. In the example, the first row is [1 0 2], and thus we take 1 times the first vector, 0 times the second vector, and 2 times the third vector.

The equation can be simplified further by using outer products:

The terms of this sum are matrices of the same shape, each describing the effect of one column of A and one row of B on the result. The columns of A can be seen as a coordinate system of the transform, i.e. given a vector x we have where are coordinates along the "axes". The terms are like , except that contains the ith coordinate for each column vector of B, each of which is transformed independently in parallel.

The example revisited:

The vectors and have been transformed to and in parallel. One could also transform them one by one with the same steps:

### Vector-lists method

The ordinary matrix product can be thought of as a dot product of a column-list of vectors and a row-list of vectors. If A and B are matrices given by:

and

where
A1 is the vector of all elements of the form a1,x      A2 is the vector of all elements of the form a2,x     etc,
and B1 is the vector of all elements of the form bx,1      B2 is the vector of all elements of the form bx,2     etc,

then

### Properties

Matrix multiplication is not commutative (that is, ABBA), except in special cases. It is easy to see why: you cannot expect to switch the proportions with the vectors and get the same result. It is also easy to see how the order of the factors determines the result when one knows that the number of columns in the proportions matrix has to be the same as the number of rows in the vectors matrix: they have to represent the same number of vectors.

Although matrix multiplication is not commutative, the determinants of AB and BA are always equal (if A and B are square matrices of the same size). See the article on determinants for an explanation.

This notion of multiplication is important because if A and B are interpreted as linear transformations (which is almost universally done), then the matrix product AB corresponds to the composition of the two linear transformations, with B being applied first.

Additionally, all notions of matrix multiplication described here share a set of common properties described below.

### Algorithms

The complexity of matrix multiplication, if carried out naively, is O(nÂ³), but more efficient algorithms do exist. Strassen's algorithm, devised by Volker Strassen in 1969 and often referred to as "fast matrix multiplication", is based on a clever way of multiplying two 2 × 2 matrices which requires only 7 multiplications (instead of the usual 8). Applying this trick recursively gives an algorithm with a cost of . In practice, though, it is rarely used since it is awkward to implement and it lacks numerical stability. The constant factor implied in the big O notation is about 4.695.

The algorithm with the lowest known exponent, which was presented by Don Coppersmith and Shmuel Winograd in 1990, has an asymptotic complexity of O(n2.376). It is similar to Strassen's algorithm: a clever way is devised for multiplying two k × k matrices with less than kÂ³ multiplications, and this technique is applied recursively. It improves on the constant factor in Strassen's algorithm, reducing it to 4.537. However, the constant term implied in the O(n2.376) result is so large that the Coppersmith–Winograd algorithm is only worthwhile for matrices that are too big to handle on present-day computers.

Since any algorithm for multiplying two n × n matrices has to process all 2 × nÂ² entries, there is an asymptotic lower bound of Ω(nÂ²) operations. Raz (2002) proves a lower bound of 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. They show that if families of wreath products of Abelian with symmetric groups satisfying certain conditions exists, matrix multiplication algorithms with essential quadratic complexity exist. Most researchers believe that this is indeed the case (Robinson, 2005).

## Scalar multiplication

The scalar multiplication of a matrix A = (aij) and a scalar r gives a product rA of the same size as A. The entries of rA are given by

If we are concerned with matrices over a ring, then the above multiplication is sometimes called the left multiplication while the right multiplication is defined to be

When the underlying ring is commutative, for example, the real or complex number field, the two multiplications are the same. However, if the ring is not commutative, such as the quaternions, they may be different. For example

For two matrices of the same dimensions, we have the Hadamard product, also known as the entrywise product and the Schur product. It can be generalized to hold not only for matrices but also for operators. The Hadamard product of two m-by-n matrices A and B, denoted by AB, is an m-by-n matrix given by (AB)ij = aijbij. For instance

.

Note that the Hadamard product is a submatrix of the Kronecker product (see below). The Hadamard product is studied by matrix theorists, and it appears in lossy compression algorithms such as JPEG, but it is virtually untouched by linear algebraists. It is discussed in (Horn & Johnson, 1994, Ch. 5).

## Kronecker product

Main article: Kronecker product.

For any two arbitrary matrices A and B, we have the direct product or Kronecker product A B defined as

Note that if A is m-by-n and B is p-by-r then A B is an mp-by-nr matrix. Again this multiplication is not commutative.

For example
.

If A and B represent linear transformations V1W1 and V2W2, respectively, then A B represents the tensor product of the two maps, V1 V2W1 W2.

## Common properties

All three notions of matrix multiplication are associative:

and distributive:

and

.

and compatible with scalar multiplication:

Note that these three separate couples of expressions will be equal to each other only if the multiplication and addition on the scalar field are commutative, i.e. the scalar field is a commutative ring. See Scalar multiplication above for a counter-example such as the scalar field of quaternions.

## Frobenius inner product

The Frobenius inner product, sometimes denoted is the component-wise inner product of two matrices as though they are vectors. In other words, the sum of the entries of the Hadamard product. That is,
This inner product induces the Frobenius norm.

## References

• Henry Cohn, Robert Kleinberg, Balazs 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., Matrix multiplication via arithmetic progressions, J. Symbolic Comput. 9, p. 251-280, 1990.
• Horn, Roger; Johnson, Charles: "Topics in Matrix Analysis", Cambridge, 1994.
• R. Raz. On the complexity of matrix product. In Proceedings of the thirty-fourth annual ACM symposium on Theory of computing. ACM Press, 2002.
• 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.

matrix (plural matrices) is a rectangular table of elements (or entries), which may be numbers or, more generally, any abstract quantities that can be added and multiplied.
In mathematics, a matrix unit is an idealisation of the concept of a matrix, with a focus on the algebraic properties of matrix multiplication. The topic is comparatively obscure within linear algebra, because it entirely ignores the numeric properties of matrices; it is mostly
spatial vector, or simply vector, is a concept characterized by a magnitude and a direction. A vector can be thought of as an arrow in Euclidean space, drawn from an initial point A pointing to a terminal point B.
coefficient is a constant multiplicative factor of a certain object. For example, the coefficient in 9x2 is 9.

The object can be such things as a variable, a vector, a function, etc.
Outer product typically refers to the tensor product or to operations with similar cardinality such as exterior product. The cardinality of these operations is that of cartesian products.

The name contrasts with the inner product, which is the product in the opposite order.
dot product, also known as the scalar product, is an operation which takes two vectors over the real numbers R and returns a real-valued scalar quantity. It is the standard inner product of the Euclidean space.
In linear algebra, a column vector is an m × 1 matrix, i.e. a matrix consisting of a single column of elements.

The transpose of a column vector is a row vector and vice versa.
In linear algebra, a row vector is a 1 × n matrix, that is, a matrix consisting of a single row:

The transpose of a row vector is a column vector.
Commutativity is a widely used mathematical term that refers to the ability to change the order of something without changing the end result. It is a fundamental property in most branches of mathematics and many proofs depend on it.
In algebra, a determinant is a function depending on n that associates a scalar, det(A), to every nÃ—n square matrix A. The fundamental geometric meaning of a determinant is as the scale factor for volume when A
In algebra, a determinant is a function depending on n that associates a scalar, det(A), to every nÃ—n square matrix A. The fundamental geometric meaning of a determinant is as the scale factor for volume when A
In mathematics, a linear map (also called a linear transformation or linear operator) is a function between two vector spaces that preserves the operations of vector addition and scalar multiplication.
As a branch of the theory of computation in computer science, computational complexity theory investigates the problems related to the amounts of resources required for the execution of algorithms (e.g.
In computational complexity theory, big O notation is often used to describe how the size of the input data affects an algorithm's usage of computational resources (usually running time or memory).
In the mathematical discipline of linear algebra, the Strassen algorithm, named after Volker Strassen, is an algorithm used for matrix multiplication. It is asymptotically faster than the standard matrix multiplication algorithm, but slower than the fastest known algorithm, and is
Volker Strassen is a German mathematician. He received in 2003, with three others, the Paris Kanellakis Award of the ACM, for the Solovay-Strassen primality test.

In 1971 Strassen published a paper together with Arnold SchÃ¶nhage on asymptotically-fast integer multiplication;
19th century - 20th century - 21st century
1930s  1940s  1950s  - 1960s -  1970s  1980s  1990s
1966 1967 1968 - 1969 - 1970 1971 1972

Also:
*:1969 (number)
*:

In the mathematical subfield of numerical analysis, numerical stability is a desirable property of numerical algorithms. The precise definition of stability depends on the context, but it is related to the accuracy of the algorithm.
In computational complexity theory, big O notation is often used to describe how the size of the input data affects an algorithm's usage of computational resources (usually running time or memory).
Don Coppersmith is a cryptographer and mathematician. He was involved in the design of the Data Encryption Standard block cipher at IBM, particularly the design of the S-boxes, strengthening them against differential cryptanalysis.
Shmuel Winograd is a computer scientist, noted for his work on fast algorithms for arithmetic, and in particular for the algorithm known as the Coppersmith-Winograd algorithm. From 1970-1974 and 1980-1994 he was the director of the Mathematical Science Department at IBM.
20th century - 21st century
1960s  1970s  1980s  - 1990s -  2000s  2010s  2020s
1987 1988 1989 - 1990 - 1991 1992 1993

Year 1990 (MCMXC) was a common year starting on Monday (link displays the 1990 Gregorian calendar).
Group theory is the mathematical study of symmetry, as embodied in the structures known as groups. These are sets with a closed binary operation satisfying the following three properties:
1. The operation must be associative.
2. There must be an identity element.

In mathematics, the wreath product of group theory is a specialized product of two groups, based on a semidirect product. Wreath products are an important tool in the classification of permutation groups and also provide a way of constructing interesting examples of groups.
In mathematics, a ring is an algebraic structure in which addition and multiplication are defined and have properties listed below. The branch of abstract algebra which studies rings is called ring theory.
Commutativity is a widely used mathematical term that refers to the ability to change the order of something without changing the end result. It is a fundamental property in most branches of mathematics and many proofs depend on it.
quaternions are a non-commutative extension of complex numbers. They were first described by the Irish mathematician, Sir William Rowan Hamilton, in 1843 and applied to mechanics in three-dimensional space.