Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Matrix Multiplication

- example
`C = A*B`

`C = mtimes(A,B)`

is
the matrix product of `C`

= `A`

*`B`

`A`

and `B`

.
If `A`

is an m-by-p and `B`

is a
p-by-n matrix, then `C`

is an m-by-n matrix defined
by

$$C(i,j)={\displaystyle \sum _{k=1}^{p}A}(i,k)B(k,j).$$

This definition says that `C(i,j)`

is the inner
product of the `i`

th row of `A`

with
the `j`

th column of `B`

. You can
write this definition using the MATLAB^{®} colon operator as

C(i,j) = A(i,:)*B(:,j)

`A`

and `B`

, the number
of columns of `A`

must equal the number of rows of `B`

.
Matrix multiplication is `A*B`

is typically
not equal to `B*A`

. If at least one input is scalar,
then `A*B`

is equivalent to `A.*B`

and
is commutative.Was this topic helpful?