Jump to content

Մասնակից:Alberti1993

Վիքիպեդիայից՝ ազատ հանրագիտարանից

Մաթեմատիկայում, matrix multiplication is a binary operationորը that takes a pair of matrices, and produces another matrix. This term may refer to a number of different ways to multiply matrices, but most commonly refers to the matrix product.[1][2]

This article will use the following notational conventions. Matrices are represented by capital letters in bold, vectors in lowercase bold, and entries of vectors and matrices are italic (since they are scalars).

Scalar multiplication[խմբագրել | խմբագրել կոդը]

The simplest form of multiplication associated with matrices is scalar multiplication.

General definition[խմբագրել | խմբագրել կոդը]

Left multiplication

The scalar multiplication of a matrix A and a scalar λ gives another matrix λ A of the same size as A. The entries of λ A are given by

explicitly:

If we are concerned with matrices over a more general ring, then the above multiplication is the left multiplication of the matrix A with scalar λ.

Right multiplication

Similarly, 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 not be equal.

Examples[խմբագրել | խմբագրել կոդը]

For a real scalar and matrix:

For quaternion scalars and matrices:

Matrix product (two matrices)[խմբագրել | խմբագրել կոդը]

Assume two matrices are to be multiplied (the generalization to any number is discussed below). If A is an n×m matrix and B is an m×p matrix, the result AB of their multiplication is an n×p matrix defined only if the number of columns m in A is equal to the number of rows m in B.

General definition[խմբագրել | խմբագրել կոդը]

The arithmetic process of multiplying numbers in row i in matrix A and column j in matrix B, then adding to obtain entry ij in the final matrix.

When multiplying matrices, the elements of the rows in the first matrix are multiplied with corresponding columns in the second matrix (depicted in the image right). One may compute each entry in the third matrix one at a time.

For two matrices

(where necessarily the number of columns in A equals the number of rows in B equals m) the matrix product AB is defined by [3][4]

(with no multiplication signs or dots) where AB has entries defined by

Treating the rows and columns in each matrix as row and column vectors respectively, this entry is also their vector dot product:

(See below for further details). Usually the entries are numbers or expressions, but can even be matrices themselves (see block matrix). The matrix product can still be calculated the same way.

Illustration[խմբագրել | խմբագրել կոդը]

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.

The values at the intersections marked with circles are:

Examples[խմբագրել | խմբագրել կոդը]

Square matrix and column vector

their matrix product is:

yet 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, d 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

their matrix products are:

and

Multiplying square matrices which represent linear transformations corresponds to the composite transformation (see below for details).

Properties of matrix multiplication[խմբագրել | խմբագրել կոդը]

General[խմբագրել | խմբագրել կոդը]

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.

All matrices[խմբագրել | խմբագրել կոդը]

  1. Not commutative (in general):
    because AB and BA may not be simultaneously defined, even if they are they may still not be equal. This is contrary to ordinary multiplication of numbers. As long as the entries of the matrix come from a ring which has an identity, and n > 1 there is a pair of n×n noncommuting matrices over the ring.
  2. Associative:
  3. Distributive over matrix addition:
  4. Scalar multiplication commutes with matrix multiplication:
    and
    where λ is a scalar. If λ belongs to the center of the ring of entries of the matrix, then all four quantities are equal, because λX = Xλ for all matrices X. This condition is automatically satisfied if the numbers in the entries come from a commutative ring, for example, a field.
  5. Transpose:
    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.
  6. Hermitian conjugate: If A and B have complex entries, then
    where denotes the Hermitian conjugate of a matrix (complex conjugate and transposed).
  7. Traces: The trace of a product AB is independent of the order of A and B:

Square matrices only[խմբագրել | խմբագրել կոդը]

  1. Identity element: If A is a square matrix, then
    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
    If this property holds then A is an invertible matrix, if not A is a singular matrix.
  3. Determinants: The determinant of a product AB is the product of the determinants of A and B:
    While the products of matrices AB and BA themselves do not always commute, the determinants of the products always do since they are numbers.

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 T, S, 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.

Matrix product (any number)[խմբագրել | խմբագրել կոդը]

Chain multiplication[խմբագրել | խմբագրել կոդը]

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

General definition[խմբագրել | խմբագրել կոդը]

The product of N matrices A1, A2, ..., AN with sizes n0×n1, n1×n2, ..., nN − 1×nN, is the n0×nN matrix:

The same properties will hold, as long as the ordering of matrices is not changed.

Examples[խմբագրել | խմբագրել կոդը]

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

is an m×n matrix.

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. For an n×n matrix A rasied a positive integer k it's defined as

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

Zero power

where I is the identity matrix. This is parallel to the zeroth power of any number which equals unity.

Scalar multiplication
Determinant

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 the binary representation of k, a method commonly used for scalars. An even better method is to use the eigenvalue decomposition of A.

Calculating high powers of matrices can be very time-consuming, but the complexity of the calculation can be dramatically decreased by using the Cayley–Hamilton theorem, which takes advantage of an identity found using the matrices' characteristic polynomial and gives a more effective equation for Ak, which instead raises a scalar to the required power, rather than an entire matrix.

Powers of diagonal matrices[խմբագրել | խմբագրել կոդը]

A special case is the power of a diagonal matrix A.

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;

meaning its 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.

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, by transposing the column vectors into row vectors.[5]

The inner product

is a column vector multiplied on the left by a row vector:

More explicitly,

The outer product

is a row vector multiplied on the left by a column vector:

where


Matrix product (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: [6]

where

The entries in the introduction were given by:


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

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).

Matrix product (in terms of outer product)

An alternative method results when the decomposition is done the other way around, i.e. the first matrix A is decomposed into column vectors and the second matrix B into row vectors :

where this time

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.

Examples[խմբագրել | խմբագրել կոդը]

Suppose

using the inner product approach:

while the outer product approach gives:

Algorithms for efficient matrix multiplication[խմբագրել | խմբագրել կոդը]

Կաղապար:Unsolved The running time of square matrix multiplication, if carried out naïvely, is . 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 . Strassen's algorithm is more complex compared to the naïve algorithm, and it lacks numerical stability. Nevertheless, it appears in several libraries, such as BLAS, where it is significantly more efficient for matrices with dimensions n > 100,[7] and is very useful for large matrices over exact domains such as finite fields, where numerical stability is not an issue.

The current algorithm with the lowest known exponent k is a generalization of the Coppersmith–Winograd algorithm that has an asymptotic complexity of O(n2.3727) due to Vassilevska Williams.[8] 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.[9]

Since any algorithm for multiplying two n×n-matrices has to process all 2×n2-entries, there is an asymptotic lower bound of 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, 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[10] – a lengthy attempt at proving this was undertaken by the late Jim Eve.[11] However, Alon, Shpilka and Umans have recently shown that some of these conjectures implying fast matrix multiplication are incompatible with another plausible conjecture, the sunflower conjecture.[12]

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. It should therefore be noted that some lower time-complexity algorithms on paper may have indirect time complexity costs on real machines.

Other forms of multiplication[խմբագրել | խմբագրել կոդը]

There are other ways to multiply two matrices, in fact simpler than the definition above.

Hadamard product[խմբագրել | խմբագրել կոդը]

For two matrices of the same dimensions, there is the Hadamard product, also known as the entrywise product and the Schur product.[13] For two matrices A and B of the same dimensions, the Hadamard product AB is a matrix of the same dimensions, which has elements

explicitly:

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

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,

where "tr" denotes the trace of a matrix. 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 contraints on the dimensions of each matrix), the Kronecker product denoted AB is a matrix with dimensions mp×nq, which has elements

explicitly:

This is the application of the more general tensor product applied to matrices. hy:Մատռիցների բազմապատկում

  1. Encyclopaedia of Physics (2nd Edition), R.G. Lerner, G.L. Trigg, VHC publishers, 1991, ISBN (Verlagsgesellschaft) 3-527-26954-1, ISBN (VHC Inc.) 0-89573-752-3
  2. McGraw Hill Encyclopaedia of Physics (2nd Edition), C.B. Parker, 1994, ISBN 0-07-051400-3
  3. Linear Algebra (4th Edition), S. Lipcshutz, M. Lipson, Schaum’s Outlines, McGraw Hill (USA), 2009, ISBN 978-0-07-154352-1
  4. 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
  5. 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
  6. Encyclopaedia of Physics (2nd Edition), R.G. Lerner, G.L. Trigg, VHC publishers, 1991, ISBN (Verlagsgesellschaft) 3-527-26954-1, ISBN (VHC Inc.) 0-89573-752-3
  7. Press 2007, p. 108.
  8. Virginia Vassilevska Williams. «Breaking the Coppersmith-Winograd barrier» (PDF). The original algorithm was presented by Don Coppersmith and Shmuel Winograd in 1990, has an asymptotic complexity of O(n2.376).
  9. Robinson, Sara (2005), «Toward an Optimal Algorithm for Matrix Multiplication» (PDF), SIAM News, 38 (9)
  10. Robinson, 2005.
  11. Eve, 2009.
  12. Alon, Shpilka, Umans, On Sunflowers and Matrix Multiplication
  13. Կաղապար:Harvard citations