Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Matrix multiplication

From Wikipedia, the free encyclopedia
Mathematical operation in linear algebra
For matrix multiplication, the number of columns in the first matrix must be equal to the number of rows in the second matrix. The result matrix has the number of rows of the first and the number of columns of the second matrix.

Inmathematics, specifically inlinear algebra,matrix multiplication is abinary operation that produces amatrix from two matrices. For matrix multiplication, the number of columns in the first matrix must be equal to the number of rows in the second matrix. The resulting matrix, known as thematrix product, has the number of rows of the first and the number of columns of the second matrix. The product of matricesA andB is denoted asAB.[1]

Matrix multiplication was first described by the French mathematicianJacques Philippe Marie Binet in 1812,[2] to represent thecomposition oflinear maps that are represented by matrices. Matrix multiplication is thus a basic tool oflinear algebra, and as such has numerous applications in many areas of mathematics, as well as inapplied mathematics,statistics,physics,economics, andengineering.[3][4]Computing matrix products is a central operation in all computational applications of linear algebra.

Notation

[edit]

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 (they are numbers from a field), e.g.A anda.Index notation is often the clearest way to express definitions, and is used as standard in the literature. The entry in rowi, columnj of matrixA is indicated by(A)ij,Aij oraij. In contrast, a single subscript, e.g.A1,A2, is used to select a matrix (not a matrix entry) from a collection of matrices.

Definitions

[edit]

Matrix times matrix

[edit]

IfA is anm ×n matrix andB is ann ×p matrix,A=(a11a12a1na21a22a2nam1am2amn),B=(b11b12b1pb21b22b2pbn1bn2bnp){\displaystyle \mathbf {A} ={\begin{pmatrix}a_{11}&a_{12}&\cdots &a_{1n}\\a_{21}&a_{22}&\cdots &a_{2n}\\\vdots &\vdots &\ddots &\vdots \\a_{m1}&a_{m2}&\cdots &a_{mn}\\\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_{n1}&b_{n2}&\cdots &b_{np}\\\end{pmatrix}}}thematrix productC =AB (denoted without multiplication signs or dots) is defined to be them ×p matrix[5][6][7][8]C=(c11c12c1pc21c22c2pcm1cm2cmp){\displaystyle \mathbf {C} ={\begin{pmatrix}c_{11}&c_{12}&\cdots &c_{1p}\\c_{21}&c_{22}&\cdots &c_{2p}\\\vdots &\vdots &\ddots &\vdots \\c_{m1}&c_{m2}&\cdots &c_{mp}\\\end{pmatrix}}}such thatcij=ai1b1j+ai2b2j++ainbnj=k=1naikbkj,{\displaystyle c_{ij}=a_{i1}b_{1j}+a_{i2}b_{2j}+\cdots +a_{in}b_{nj}=\sum _{k=1}^{n}a_{ik}b_{kj},}fori = 1, ...,m andj = 1, ...,p.

That is, the entrycij{\displaystyle c_{ij}} of the product is obtained by multiplying term-by-term the entries of theith row ofA and thejth column ofB, and summing thesen products. In other words,cij{\displaystyle c_{ij}} is thedot product of theith row ofA and thejth column ofB.

Therefore,AB can also be written asC=(a11b11++a1nbn1a11b12++a1nbn2a11b1p++a1nbnpa21b11++a2nbn1a21b12++a2nbn2a21b1p++a2nbnpam1b11++amnbn1am1b12++amnbn2am1b1p++amnbnp){\displaystyle \mathbf {C} ={\begin{pmatrix}a_{11}b_{11}+\cdots +a_{1n}b_{n1}&a_{11}b_{12}+\cdots +a_{1n}b_{n2}&\cdots &a_{11}b_{1p}+\cdots +a_{1n}b_{np}\\a_{21}b_{11}+\cdots +a_{2n}b_{n1}&a_{21}b_{12}+\cdots +a_{2n}b_{n2}&\cdots &a_{21}b_{1p}+\cdots +a_{2n}b_{np}\\\vdots &\vdots &\ddots &\vdots \\a_{m1}b_{11}+\cdots +a_{mn}b_{n1}&a_{m1}b_{12}+\cdots +a_{mn}b_{n2}&\cdots &a_{m1}b_{1p}+\cdots +a_{mn}b_{np}\\\end{pmatrix}}}

Thus the productAB is defined if and only if the number of columns inA equals the number of rows inB,[1] in this casen.

In most scenarios, the entries are numbers, but they may be any kind ofmathematical objects for which an addition and a multiplication are defined, that areassociative, and such that the addition iscommutative, and the multiplication isdistributive with respect to the addition. In particular, the entries may be matrices themselves (seeblock matrix).

Matrix times vector

[edit]

A vectorx{\displaystyle \mathbf {x} } of lengthn{\displaystyle n} can be viewed as acolumn vector, corresponding to ann×1{\displaystyle n\times 1} matrixX{\displaystyle \mathbf {X} } whose entries are given byXi1=xi.{\displaystyle \mathbf {X} _{i1}=\mathbf {x} _{i}.} IfA{\displaystyle \mathbf {A} } is anm×n{\displaystyle m\times n} matrix, the matrix-times-vector product denoted byAx{\displaystyle \mathbf {Ax} } is then the vectory{\displaystyle \mathbf {y} } that, viewed as a column vector, is equal to them×1{\displaystyle m\times 1} matrixAX.{\displaystyle \mathbf {AX} .} In index notation, this amounts to:

yi=j=1naijxj.{\displaystyle y_{i}=\sum _{j=1}^{n}a_{ij}x_{j}.}

One way of looking at this is that the changes from "plain" vector to column vector and back are assumed and left implicit.

Vector times matrix

[edit]

Similarly, a vectorx{\displaystyle \mathbf {x} } of lengthn{\displaystyle n} can be viewed as arow vector, corresponding to a1×n{\displaystyle 1\times n} matrix. To make it clear that a row vector is meant, it is customary in this context to represent it as thetranspose of a column vector; thus, one will see notations such asxTA.{\displaystyle \mathbf {x} ^{\mathrm {T} }\mathbf {A} .} The identityxTA=(ATx)T{\displaystyle \mathbf {x} ^{\mathrm {T} }\mathbf {A} =(\mathbf {A} ^{\mathrm {T} }\mathbf {x} )^{\mathrm {T} }} holds. In index notation, ifA{\displaystyle \mathbf {A} } is ann×p{\displaystyle n\times p} matrix,xTA=yT{\displaystyle \mathbf {x} ^{\mathrm {T} }\mathbf {A} =\mathbf {y} ^{\mathrm {T} }} amounts to:yk=j=1nxjajk.{\displaystyle y_{k}=\sum _{j=1}^{n}x_{j}a_{jk}.}

Vector times vector

[edit]

Thedot productab{\displaystyle \mathbf {a} \cdot \mathbf {b} } of two vectorsa{\displaystyle \mathbf {a} } andb{\displaystyle \mathbf {b} } of equal length is equal to the single entry of the1×1{\displaystyle 1\times 1} matrix resulting from multiplying these vectors as a row and a column vector, thus:aTb{\displaystyle \mathbf {a} ^{\mathrm {T} }\mathbf {b} } (orbTa,{\displaystyle \mathbf {b} ^{\mathrm {T} }\mathbf {a} ,} which results in the same1×1{\displaystyle 1\times 1} matrix).

Illustration

[edit]

The figure to the right illustrates diagrammatically the product of two matricesA andB, showing how each intersection in the product matrix corresponds to a row ofA and a column ofB.[a11a12a31a32]4×2 matrix[b12b13b22b23]2×3 matrix=[c12c33]4×3 matrix{\displaystyle {\overset {4\times 2{\text{ matrix}}}{\begin{bmatrix}a_{11}&a_{12}\\\cdot &\cdot \\a_{31}&a_{32}\\\cdot &\cdot \\\end{bmatrix}}}{\overset {2\times 3{\text{ matrix}}}{\begin{bmatrix}\cdot &b_{12}&b_{13}\\\cdot &b_{22}&b_{23}\\\end{bmatrix}}}={\overset {4\times 3{\text{ matrix}}}{\begin{bmatrix}\cdot &c_{12}&\cdot \\\cdot &\cdot &\cdot \\\cdot &\cdot &c_{33}\\\cdot &\cdot &\cdot \\\end{bmatrix}}}}

The values at the intersections, marked with circles in figure to the right, are:c12=a11b12+a12b22c33=a31b13+a32b23.{\displaystyle {\begin{aligned}c_{12}&=a_{11}b_{12}+a_{12}b_{22}\\c_{33}&=a_{31}b_{13}+a_{32}b_{23}.\end{aligned}}}

Fundamental applications

[edit]

Historically, matrix multiplication has been introduced for facilitating and clarifying computations inlinear algebra. This strong relationship between matrix multiplication and linear algebra remains fundamental in all mathematics, as well as inphysics,chemistry,engineering andcomputer science.

Linear maps

[edit]

If avector space has a finitebasis, its vectors are each uniquely represented by a finitesequence of scalars, called acoordinate vector, whose elements are thecoordinates of the vector on the basis. These coordinate vectors form another vector space, which isisomorphic to the original vector space. A coordinate vector is commonly organized as acolumn matrix (also called acolumn vector), which is a matrix with only one column. So, a column vector represents both a coordinate vector, and a vector of the original vector space.

Alinear mapA from a vector space of dimensionn into a vector space of dimensionm maps a column vector

x=(x1x2xn){\displaystyle \mathbf {x} ={\begin{pmatrix}x_{1}\\x_{2}\\\vdots \\x_{n}\end{pmatrix}}}

onto the column vector

y=A(x)=(a11x1++a1nxna21x1++a2nxnam1x1++amnxn).{\displaystyle \mathbf {y} =A(\mathbf {x} )={\begin{pmatrix}a_{11}x_{1}+\cdots +a_{1n}x_{n}\\a_{21}x_{1}+\cdots +a_{2n}x_{n}\\\vdots \\a_{m1}x_{1}+\cdots +a_{mn}x_{n}\end{pmatrix}}.}

The linear mapA is thus defined by the matrix

A=(a11a12a1na21a22a2nam1am2amn),{\displaystyle \mathbf {A} ={\begin{pmatrix}a_{11}&a_{12}&\cdots &a_{1n}\\a_{21}&a_{22}&\cdots &a_{2n}\\\vdots &\vdots &\ddots &\vdots \\a_{m1}&a_{m2}&\cdots &a_{mn}\\\end{pmatrix}},}

and maps the column vectorx{\displaystyle \mathbf {x} } to the matrix product

y=Ax.{\displaystyle \mathbf {y} =\mathbf {Ax} .}

IfB is another linear map from the preceding vector space of dimensionm, into a vector space of dimensionp, it is represented by ap×m{\displaystyle p\times m} matrixB.{\displaystyle \mathbf {B} .} A straightforward computation shows that the matrix of thecomposite mapBA{\displaystyle B\circ A} is the matrix productBA.{\displaystyle \mathbf {BA} .} The general formula(BA)(x)=B(A(x)){\displaystyle (B\circ A)(\mathbf {x} )=B(A(\mathbf {x} ))}) that defines the function composition is instanced here as a specific case of associativity of matrix product (see§ Associativity below):

(BA)x=B(Ax)=BAx.{\displaystyle (\mathbf {BA} )\mathbf {x} =\mathbf {B} (\mathbf {Ax} )=\mathbf {BAx} .}

Geometric rotations

[edit]
See also:Rotation matrix

Using aCartesian coordinate system in a Euclidean plane, therotation by an angleα{\displaystyle \alpha } around theorigin is a linear map.More precisely,[xy]=[cosαsinαsinαcosα][xy],{\displaystyle {\begin{bmatrix}x'\\y'\end{bmatrix}}={\begin{bmatrix}\cos \alpha &-\sin \alpha \\\sin \alpha &\cos \alpha \end{bmatrix}}{\begin{bmatrix}x\\y\end{bmatrix}},}where the source point(x,y){\displaystyle (x,y)} and its image(x,y){\displaystyle (x',y')} are written as column vectors.

The composition of the rotation byα{\displaystyle \alpha } and that byβ{\displaystyle \beta } then corresponds to the matrix product[cosβsinβsinβcosβ][cosαsinαsinαcosα]=[cosβcosαsinβsinαcosβsinαsinβcosαsinβcosα+cosβsinαsinβsinα+cosβcosα]=[cos(α+β)sin(α+β)sin(α+β)cos(α+β)],{\displaystyle {\begin{bmatrix}\cos \beta &-\sin \beta \\\sin \beta &\cos \beta \end{bmatrix}}{\begin{bmatrix}\cos \alpha &-\sin \alpha \\\sin \alpha &\cos \alpha \end{bmatrix}}={\begin{bmatrix}\cos \beta \cos \alpha -\sin \beta \sin \alpha &-\cos \beta \sin \alpha -\sin \beta \cos \alpha \\\sin \beta \cos \alpha +\cos \beta \sin \alpha &-\sin \beta \sin \alpha +\cos \beta \cos \alpha \end{bmatrix}}={\begin{bmatrix}\cos(\alpha +\beta )&-\sin(\alpha +\beta )\\\sin(\alpha +\beta )&\cos(\alpha +\beta )\end{bmatrix}},}where appropriatetrigonometric identities are employed for the second equality.That is, the composition corresponds to the rotation by angleα+β{\displaystyle \alpha +\beta }, as expected.

Resource allocation in economics

[edit]
The computation of the bottom left entry ofAB{\displaystyle \mathbf {AB} } corresponds to the consideration of all paths (highlighted) from basic commodityb4{\displaystyle b_{4}} to final productf1{\displaystyle f_{1}} in the production flow graph.

As an example, a fictitious factory uses 4 kinds ofbasic commodities,b1,b2,b3,b4{\displaystyle b_{1},b_{2},b_{3},b_{4}} to produce 3 kinds ofintermediate goods,m1,m2,m3{\displaystyle m_{1},m_{2},m_{3}}, which in turn are used to produce 3 kinds offinal products,f1,f2,f3{\displaystyle f_{1},f_{2},f_{3}}. The matrices

A=(101211011112){\displaystyle \mathbf {A} ={\begin{pmatrix}1&0&1\\2&1&1\\0&1&1\\1&1&2\\\end{pmatrix}}}   and  B=(121231422){\displaystyle \mathbf {B} ={\begin{pmatrix}1&2&1\\2&3&1\\4&2&2\\\end{pmatrix}}}

provide the amount of basic commodities needed for a given amount of intermediate goods, and the amount of intermediate goods needed for a given amount of final products, respectively.For example, to produce one unit of intermediate goodm1{\displaystyle m_{1}}, one unit of basic commodityb1{\displaystyle b_{1}}, two units ofb2{\displaystyle b_{2}}, no units ofb3{\displaystyle b_{3}}, and one unit ofb4{\displaystyle b_{4}} are needed, corresponding to the first column ofA{\displaystyle \mathbf {A} }.

Using matrix multiplication, compute

AB=(543895 6531196);{\displaystyle \mathbf {AB} ={\begin{pmatrix}5&4&3\\8&9&5\\\ 6&5&3\\11&9&6\\\end{pmatrix}};}

this matrix directly provides the amounts of basic commodities needed for given amounts of final goods. For example, the bottom left entry ofAB{\displaystyle \mathbf {AB} } is computed as11+12+24=11{\displaystyle 1\cdot 1+1\cdot 2+2\cdot 4=11}, reflecting that11{\displaystyle 11} units ofb4{\displaystyle b_{4}} are needed to produce one unit off1{\displaystyle f_{1}}. Indeed, oneb4{\displaystyle b_{4}} unit is needed form1{\displaystyle m_{1}}, one for each of twom2{\displaystyle m_{2}}, and2{\displaystyle 2} for each of the fourm3{\displaystyle m_{3}} units that go into thef1{\displaystyle f_{1}} unit, see picture.

In order to produce e.g. 100 units of the final productf1{\displaystyle f_{1}}, 80 units off2{\displaystyle f_{2}}, and 60 units off3{\displaystyle f_{3}}, the necessary amounts of basic goods can be computed as

(AB)(1008060)=(1000182011802180),{\displaystyle (\mathbf {AB} ){\begin{pmatrix}100\\80\\60\\\end{pmatrix}}={\begin{pmatrix}1000\\1820\\1180\\2180\end{pmatrix}},}

that is,1000{\displaystyle 1000} units ofb1{\displaystyle b_{1}},1820{\displaystyle 1820} units ofb2{\displaystyle b_{2}},1180{\displaystyle 1180} units ofb3{\displaystyle b_{3}},2180{\displaystyle 2180} units ofb4{\displaystyle b_{4}} are needed.Similarly, the product matrixAB{\displaystyle \mathbf {AB} } can be used to compute the needed amounts of basic goods for other final-good amount data.[9]

System of linear equations

[edit]

The general form of asystem of linear equations is

a11x1++a1nxn=b1,a21x1++a2nxn=b2,am1x1++amnxn=bm.{\displaystyle {\begin{matrix}a_{11}x_{1}+\cdots +a_{1n}x_{n}=b_{1},\\a_{21}x_{1}+\cdots +a_{2n}x_{n}=b_{2},\\\vdots \\a_{m1}x_{1}+\cdots +a_{mn}x_{n}=b_{m}.\end{matrix}}}

Using same notation as above, such a system is equivalent with the single matrixequation

Ax=b.{\displaystyle \mathbf {Ax} =\mathbf {b} .}

Dot product, bilinear form and sesquilinear form

[edit]

Thedot product of two column vectors is the unique entry of the matrix product

xTy,{\displaystyle \mathbf {x} ^{\mathsf {T}}\mathbf {y} ,}

wherexT{\displaystyle \mathbf {x} ^{\mathsf {T}}} is therow vector obtained bytransposingx{\displaystyle \mathbf {x} }. (As usual, a 1×1 matrix is identified with its unique entry.)

More generally, anybilinear form over a vector space of finite dimension may be expressed as a matrix product

xTAy,{\displaystyle \mathbf {x} ^{\mathsf {T}}\mathbf {Ay} ,}

and anysesquilinear form may be expressed as

xAy,{\displaystyle \mathbf {x} ^{\dagger }\mathbf {Ay} ,}

wherex{\displaystyle \mathbf {x} ^{\dagger }} denotes theconjugate transpose ofx{\displaystyle \mathbf {x} } (conjugate of the transpose, or equivalently transpose of the conjugate).

General properties

[edit]

Matrix multiplication shares some properties with usualmultiplication. However, matrix multiplication is not defined if the number of columns of the first factor differs from the number of rows of the second factor, and it isnon-commutative,[10] even when the product remains defined after changing the order of the factors.[11][12]

Non-commutativity

[edit]

An operation iscommutative if, given two elementsA andB such that the productAB{\displaystyle \mathbf {A} \mathbf {B} } is defined, thenBA{\displaystyle \mathbf {B} \mathbf {A} } is also defined, andAB=BA.{\displaystyle \mathbf {A} \mathbf {B} =\mathbf {B} \mathbf {A} .}

IfA andB are matrices of respective sizesm×n{\displaystyle m\times n} andp×q{\displaystyle p\times q}, thenAB{\displaystyle \mathbf {A} \mathbf {B} } is defined ifn=p{\displaystyle n=p}, andBA{\displaystyle \mathbf {B} \mathbf {A} } is defined ifm=q{\displaystyle m=q}. Therefore, if one of the products is defined, the other one need not be defined. Ifm=qn=p{\displaystyle m=q\neq n=p}, the two products are defined, but have different sizes; thus they cannot be equal. Only ifm=q=n=p{\displaystyle m=q=n=p}, that is, ifA andB aresquare matrices of the same size, are both products defined and of the same size. Even in this case, one has in general

ABBA.{\displaystyle \mathbf {A} \mathbf {B} \neq \mathbf {B} \mathbf {A} .}

For example

(0100)(0010)=(1000),{\displaystyle {\begin{pmatrix}0&1\\0&0\end{pmatrix}}{\begin{pmatrix}0&0\\1&0\end{pmatrix}}={\begin{pmatrix}1&0\\0&0\end{pmatrix}},}

but

(0010)(0100)=(0001).{\displaystyle {\begin{pmatrix}0&0\\1&0\end{pmatrix}}{\begin{pmatrix}0&1\\0&0\end{pmatrix}}={\begin{pmatrix}0&0\\0&1\end{pmatrix}}.}

This example may be expanded for showing that, ifA is an×n{\displaystyle n\times n} matrix with entries in afieldF, thenAB=BA{\displaystyle \mathbf {A} \mathbf {B} =\mathbf {B} \mathbf {A} } for everyn×n{\displaystyle n\times n} matrixB with entries inF,if and only ifA=cI{\displaystyle \mathbf {A} =c\,\mathbf {I} } wherecF{\displaystyle c\in F}, andI is then×n{\displaystyle n\times n}identity matrix. If, instead of a field, the entries are supposed to belong to aring, then one must add the condition thatc belongs to thecenter of the ring.

One special case where commutativity does occur is whenD andE are two (square)diagonal matrices (of the same size); thenDE =ED.[10] Again, if the matrices are over a general ring rather than a field, the corresponding entries in each must also commute with each other for this to hold.

Distributivity

[edit]

The matrix product isdistributive with respect tomatrix addition. That is, ifA,B,C,D are matrices of respective sizesm ×n,n ×p,n ×p, andp ×q, respectively, one has (left distributivity)

A(B+C)=AB+AC,{\displaystyle \mathbf {A} (\mathbf {B} +\mathbf {C} )=\mathbf {AB} +\mathbf {AC} ,}

and (right distributivity)

(B+C)D=BD+CD.{\displaystyle (\mathbf {B} +\mathbf {C} )\mathbf {D} =\mathbf {BD} +\mathbf {CD} .}[10]

This results from the distributivity for coefficients by

kaik(bkj+ckj)=kaikbkj+kaikckj{\displaystyle \sum _{k}a_{ik}(b_{kj}+c_{kj})=\sum _{k}a_{ik}b_{kj}+\sum _{k}a_{ik}c_{kj}}
k(bik+cik)dkj=kbikdkj+kcikdkj.{\displaystyle \sum _{k}(b_{ik}+c_{ik})d_{kj}=\sum _{k}b_{ik}d_{kj}+\sum _{k}c_{ik}d_{kj}.}

Product with a scalar

[edit]

IfA is a matrix andc a scalar, then the matricescA{\displaystyle c\mathbf {A} } andAc{\displaystyle \mathbf {A} c} are obtained by left or right multiplying all entries ofA byc. If the scalars have thecommutative property, thencA=Ac.{\displaystyle c\mathbf {A} =\mathbf {A} c.}

If the productAB{\displaystyle \mathbf {AB} } is defined (that is, the number of columns ofA equals the number of rows ofB), then

c(AB)=(cA)B{\displaystyle c(\mathbf {AB} )=(c\mathbf {A} )\mathbf {B} } and(AB)c=A(Bc).{\displaystyle (\mathbf {A} \mathbf {B} )c=\mathbf {A} (\mathbf {B} c).}

If the scalars have the commutative property, then all four matrices are equal. More generally, all four are equal ifc belongs to thecenter of aring containing the entries of the matrices, because in this case,cX =Xc for all matricesX.

These properties result from thebilinearity of the product of scalars:

c(kaikbkj)=k(caik)bkj{\displaystyle c\left(\sum _{k}a_{ik}b_{kj}\right)=\sum _{k}(ca_{ik})b_{kj}}
(kaikbkj)c=kaik(bkjc).{\displaystyle \left(\sum _{k}a_{ik}b_{kj}\right)c=\sum _{k}a_{ik}(b_{kj}c).}

Transpose

[edit]

If the scalars have thecommutative property, thetranspose of a product of matrices is the product, in the reverse order, of the transposes of the factors. That is

(AB)T=BTAT{\displaystyle (\mathbf {AB} )^{\mathsf {T}}=\mathbf {B} ^{\mathsf {T}}\mathbf {A} ^{\mathsf {T}}}

whereT denotes the transpose, that is the interchange of rows and columns.

This identity does not hold for noncommutative entries, since the order between the entries ofA andB is reversed, when one expands the definition of the matrix product.

Complex conjugate

[edit]

IfA andB havecomplex entries, then

(AB)=AB{\displaystyle (\mathbf {AB} )^{*}=\mathbf {A} ^{*}\mathbf {B} ^{*}}

where* denotes the entry-wisecomplex conjugate of a matrix.

This results from applying to the definition of matrix product the fact that the conjugate of a sum is the sum of the conjugates of the summands and the conjugate of a product is the product of the conjugates of the factors.

Transposition acts on the indices of the entries, while conjugation acts independently on the entries themselves. It results that, ifA andB have complex entries, one has

(AB)=BA,{\displaystyle (\mathbf {AB} )^{\dagger }=\mathbf {B} ^{\dagger }\mathbf {A} ^{\dagger },}

where denotes theconjugate transpose (conjugate of the transpose, or equivalently transpose of the conjugate).

Associativity

[edit]

Given three matricesA,B andC, the products(AB)C andA(BC) are defined if and only if the number of columns ofA equals the number of rows ofB, and the number of columns ofB equals the number of rows ofC (in particular, if one of the products is defined, then the other is also defined). In this case, one has theassociative property

(AB)C=A(BC).{\displaystyle (\mathbf {AB} )\mathbf {C} =\mathbf {A} (\mathbf {BC} ).}

As for any associative operation, this allows omitting parentheses, and writing the above products asABC.{\displaystyle \mathbf {ABC} .}

This extends naturally to the product of any number of matrices provided that the dimensions match. That is, ifA1,A2, ...,An are matrices such that the number of columns ofAi equals the number of rows ofAi + 1 fori = 1, ...,n – 1, then the product

i=1nAi=A1A2An{\displaystyle \prod _{i=1}^{n}\mathbf {A} _{i}=\mathbf {A} _{1}\mathbf {A} _{2}\cdots \mathbf {A} _{n}}

is defined and does not depend on theorder of the multiplications, if the order of the matrices is kept fixed.

These properties may be proved by straightforward but complicatedsummation manipulations. This result also follows from the fact that matrices representlinear maps. Therefore, the associative property of matrices is simply a specific case of the associative property offunction composition.

Computational complexity depends on parenthesization

[edit]

Although the result of a sequence of matrix products does not depend on theorder of operation (provided that the order of the matrices is not changed), thecomputational complexity may depend dramatically on this order.

For example, ifA,B andC are matrices of respective sizes10×30, 30×5, 5×60, computing(AB)C needs10×30×5 + 10×5×60 = 4,500 multiplications, while computingA(BC) needs30×5×60 + 10×30×60 = 27,000 multiplications.

Algorithms have been designed for choosing the best order of products; seeMatrix chain multiplication. When the numbern of matrices increases, it has been shown that the choice of the best order has a complexity ofO(nlogn).{\displaystyle O(n\log n).}[13][14]

Application to similarity

[edit]

Anyinvertible matrixP{\displaystyle \mathbf {P} } defines asimilarity transformation (on square matrices of the same size asP{\displaystyle \mathbf {P} })

SP(A)=P1AP.{\displaystyle S_{\mathbf {P} }(\mathbf {A} )=\mathbf {P} ^{-1}\mathbf {A} \mathbf {P} .}

Similarity transformations map product to products, that is

SP(AB)=SP(A)SP(B).{\displaystyle S_{\mathbf {P} }(\mathbf {AB} )=S_{\mathbf {P} }(\mathbf {A} )S_{\mathbf {P} }(\mathbf {B} ).}

In fact, one has

P1(AB)P=P1A(PP1)BP=(P1AP)(P1BP).{\displaystyle \mathbf {P} ^{-1}(\mathbf {AB} )\mathbf {P} =\mathbf {P} ^{-1}\mathbf {A} (\mathbf {P} \mathbf {P} ^{-1})\mathbf {B} \mathbf {P} =(\mathbf {P} ^{-1}\mathbf {A} \mathbf {P} )(\mathbf {P} ^{-1}\mathbf {B} \mathbf {P} ).}

Square matrices

[edit]

Let us denoteMn(R){\displaystyle {\mathcal {M}}_{n}(R)} the set ofn×nsquare matrices with entries in aringR, which, in practice, is often afield.

InMn(R){\displaystyle {\mathcal {M}}_{n}(R)}, the product is defined for every pair of matrices. This makesMn(R){\displaystyle {\mathcal {M}}_{n}(R)} aring, which has theidentity matrixI as anidentity element (the matrix whose diagonal entries are equal to 1 and all other entries are 0). This ring is also anassociativeR-algebra.

Ifn > 1, many matrices do not have amultiplicative inverse. For example, a matrix such that all entries of a row (or a column) are 0 does not have an inverse. If it exists, the inverse of a matrixA is denotedA−1, and, thus verifies

AA1=A1A=I.{\displaystyle \mathbf {A} \mathbf {A} ^{-1}=\mathbf {A} ^{-1}\mathbf {A} =\mathbf {I} .}

A matrix that has an inverse is aninvertible matrix. Otherwise, it is asingular matrix.

A product of matrices is invertible if and only if each factor is invertible. In this case, one has

(AB)1=B1A1.{\displaystyle (\mathbf {A} \mathbf {B} )^{-1}=\mathbf {B} ^{-1}\mathbf {A} ^{-1}.}

WhenR iscommutative, and, in particular, when it is a field, thedeterminant of a product is the product of the determinants. As determinants are scalars, and scalars commute, one has thus

det(AB)=det(BA)=det(A)det(B).{\displaystyle \det(\mathbf {AB} )=\det(\mathbf {BA} )=\det(\mathbf {A} )\det(\mathbf {B} ).}

The other matrixinvariants do not behave as well with products. Nevertheless, ifR is commutative,AB andBA have the sametrace, the samecharacteristic polynomial, and the sameeigenvalues with the same multiplicities. However, theeigenvectors are generally different ifABBA.

Powers of a matrix

[edit]

One may raise a square matrix to anynonnegative integer power multiplying it by itself repeatedly in the same way as for ordinary numbers. That is,

A0=I,{\displaystyle \mathbf {A} ^{0}=\mathbf {I} ,}
A1=A,{\displaystyle \mathbf {A} ^{1}=\mathbf {A} ,}
Ak=AAAk times.{\displaystyle \mathbf {A} ^{k}=\underbrace {\mathbf {A} \mathbf {A} \cdots \mathbf {A} } _{k{\text{ times}}}.}

Computing thekth power of a matrix needsk – 1 times the time of a single matrix multiplication, if it is done with the trivial algorithm (repeated multiplication). As this may be very time consuming, one generally prefers usingexponentiation by squaring, which requires less than2 log2k matrix multiplications, and is therefore much more efficient.

An easy case for exponentiation is that of adiagonal matrix. Since the product of diagonal matrices amounts to simply multiplying corresponding diagonal elements together, thekth power of a diagonal matrix is obtained by raising the entries to the powerk:

[a11000a22000ann]k=[a11k000a22k000annk].{\displaystyle {\begin{bmatrix}a_{11}&0&\cdots &0\\0&a_{22}&\cdots &0\\\vdots &\vdots &\ddots &\vdots \\0&0&\cdots &a_{nn}\end{bmatrix}}^{k}={\begin{bmatrix}a_{11}^{k}&0&\cdots &0\\0&a_{22}^{k}&\cdots &0\\\vdots &\vdots &\ddots &\vdots \\0&0&\cdots &a_{nn}^{k}\end{bmatrix}}.}

Abstract algebra

[edit]

The definition of matrix product requires that the entries belong to a semiring, and does not require multiplication of elements of the semiring to becommutative. In many applications, the matrix elements belong to a field, although thetropical semiring is also a common choice for graphshortest path problems.[15] Even in the case of matrices over fields, the product is not commutative in general, although it isassociative and isdistributive overmatrix addition. Theidentity matrices (which are thesquare matrices whose entries are zero outside of the main diagonal and 1 on the main diagonal) areidentity elements of the matrix product. It follows that then ×n matrices over aring form a ring, which is noncommutative except ifn = 1 and the ground ring is commutative.

A square matrix may have amultiplicative inverse, called aninverse matrix. In the common case where the entries belong to acommutative ringR, a matrix has an inverse if and only if itsdeterminant has a multiplicative inverse inR. The determinant of a product of square matrices is the product of the determinants of the factors. Then ×n matrices that have an inverse form agroup under matrix multiplication, thesubgroups of which are calledmatrix groups. Many classical groups (including allfinite groups) areisomorphic to matrix groups; this is the starting point of the theory ofgroup representations.

Matrices are themorphisms of acategory, thecategory of matrices. The objects are thenatural numbers that measure the size of matrices, and the composition of morphisms is matrix multiplication. The source of a morphism is the number of columns of the corresponding matrix, and the target is the number of rows.

Computational complexity

[edit]
Main article:Computational complexity of matrix multiplication
For implementation techniques (in particular parallel and distributed algorithms), seeMatrix multiplication algorithm.
Improvement of estimates of exponentω over time for the computational complexity of matrix multiplicationO(nω){\displaystyle O(n^{\omega })}

The matrix multiplicationalgorithm that results from the definition requires, in theworst case,n3{\displaystyle n^{3}} multiplications and(n1)n2{\displaystyle (n-1)n^{2}} additions of scalars to compute the product of two squaren×n matrices. Itscomputational complexity is thereforeO(n3){\displaystyle O(n^{3})}, in amodel of computation for which the scalar operations take constant time.

Rather surprisingly, this complexity is not optimal, as shown in 1969 byVolker Strassen, who provided an algorithm, now calledStrassen's algorithm, with a complexity ofO(nlog27)O(n2.8074).{\displaystyle O(n^{\log _{2}7})\approx O(n^{2.8074}).}[16]Strassen's algorithm can be parallelized to further improve the performance.[17]As of January 2024[update], the best peer-reviewed matrix multiplication algorithm is byVirginia Vassilevska Williams, Yinzhan Xu, Zixuan Xu, and Renfei Zhou and has complexityO(n2.371552).[18][19]It is not known whether matrix multiplication can be performed inn2 + o(1) time.[20] This would be optimal, since one must read then2{\displaystyle n^{2}} elements of a matrix in order to multiply it with another matrix.

Since matrix multiplication forms the basis for many algorithms, and many operations on matrices even have the same complexity as matrix multiplication (up to a multiplicative constant), the computational complexity of matrix multiplication appears throughoutnumerical linear algebra andtheoretical computer science.

Generalizations

[edit]

Other types of products of matrices include:

See also

[edit]
  • Matrix calculus, for the interaction of matrix multiplication with operations from calculus

Notes

[edit]
  1. ^abNykamp, Duane."Multiplying matrices and vectors".Math Insight. RetrievedSeptember 6, 2020.
  2. ^O'Connor, John J.;Robertson, Edmund F.,"Jacques Philippe Marie Binet",MacTutor History of Mathematics Archive,University of St Andrews
  3. ^Lerner, R. G.; Trigg, G. L. (1991).Encyclopaedia of Physics (2nd ed.). VHC publishers.ISBN 978-3-527-26954-9.
  4. ^Parker, C. B. (1994).McGraw Hill Encyclopaedia of Physics (2nd ed.). McGraw-Hill.ISBN 978-0-07-051400-3.
  5. ^Lipschutz, S.; Lipson, M. (2009).Linear Algebra. Schaum's Outlines (4th ed.). McGraw Hill (USA). pp. 30–31.ISBN 978-0-07-154352-1.
  6. ^Riley, K. F.; Hobson, M. P.; Bence, S. J. (2010).Mathematical methods for physics and engineering. Cambridge University Press.ISBN 978-0-521-86153-3.
  7. ^Adams, R. A. (1995).Calculus, A Complete Course (3rd ed.). Addison Wesley. p. 627.ISBN 0-201-82823-5.
  8. ^Horn, Johnson (2013).Matrix Analysis (2nd ed.). Cambridge University Press. p. 6.ISBN 978-0-521-54823-6.
  9. ^Peter Stingl (1996).Mathematik für Fachhochschulen – Technik und Informatik (in German) (5th ed.).Munich:Carl Hanser Verlag.ISBN 3-446-18668-9. Here: Exm.5.4.10, p.205-206
  10. ^abcWeisstein, Eric W."Matrix Multiplication".mathworld.wolfram.com. Retrieved2020-09-06.
  11. ^Lipcshutz, S.; Lipson, M. (2009). "2".Linear Algebra. Schaum's Outlines (4th ed.). McGraw Hill (USA).ISBN 978-0-07-154352-1.
  12. ^Horn, Johnson (2013). "Chapter 0".Matrix Analysis (2nd ed.). Cambridge University Press.ISBN 978-0-521-54823-6.
  13. ^Hu, T. C.; Shing, M.-T. (1982)."Computation of Matrix Chain Products, Part I"(PDF).SIAM Journal on Computing.11 (2):362–373.CiteSeerX 10.1.1.695.2923.doi:10.1137/0211028.ISSN 0097-5397.
  14. ^Hu, T. C.; Shing, M.-T. (1984)."Computation of Matrix Chain Products, Part II"(PDF).SIAM Journal on Computing.13 (2):228–251.CiteSeerX 10.1.1.695.4875.doi:10.1137/0213017.ISSN 0097-5397.
  15. ^Motwani, Rajeev;Raghavan, Prabhakar (1995).Randomized Algorithms. Cambridge University Press. p. 280.ISBN 9780521474658.
  16. ^Volker Strassen (Aug 1969)."Gaussian elimination is not optimal".Numerische Mathematik.13 (4):354–356.doi:10.1007/BF02165411.S2CID 121656251.
  17. ^C.-C. Chou and Y.-F. Deng and G. Li and Y. Wang (1995)."Parallelizing Strassen's Method for Matrix Multiplication on Distributed-Memory MIMD Architectures"(PDF).Computers Math. Applic.30 (2):49–69.doi:10.1016/0898-1221(95)00077-C.
  18. ^Vassilevska Williams, Virginia; Xu, Yinzhan; Xu, Zixuan; Zhou, Renfei.New Bounds for Matrix Multiplication: from Alpha to Omega. Proceedings of the 2024 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA). pp. 3792–3835.arXiv:2307.07970.doi:10.1137/1.9781611977912.134.
  19. ^Nadis, Steve (March 7, 2024)."New Breakthrough Brings Matrix Multiplication Closer to Ideal". Retrieved2024-03-09.
  20. ^that is, in timen2+f(n), for some functionf withf(n)0 asn→∞

References

[edit]
Wikimedia Commons has media related tomatrix multiplication.
The WikibookLinear Algebra has a page on the topic of:Matrix multiplication
The WikibookApplicable Mathematics has a page on the topic of:Multiplying Matrices
Linear equations
Three dimensional Euclidean space
Matrices
Matrix decompositions
Relations and computations
Vector spaces
Structures
Multilinear algebra
Affine and projective
Numerical linear algebra
Retrieved from "https://en.wikipedia.org/w/index.php?title=Matrix_multiplication&oldid=1323669517"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp