Number of ways two matrices can be multiplied?

122 Views Asked by At

Given the dimensions of two matrices what are the different ways they can be multiplied? Example $A[2][2]$ and $B[2][2]$ then answer is $2$. Let the dimensions of first matrix be $n \times m$ and second be $m \times p$.

1

There are 1 best solutions below

2
On

Supposing that by "different ways" you mean different orders, then using the fact that $AB$ is defined iff the number of columns of $A$ is the number of rows of $B$, then the answer is as follows:

If the dimensions of $A$ are $m \times n$ and those of $B$ are $m' \times n'$ then:

  • there are two ways ($AB$, $BA$) if $n' = m$ and $n = m'$,
  • there is one way ($AB$) if $n = m'$ and $n' \neq m$,
  • there is one way ($BA$) if $n' = m$ and $n \neq m'$, amd
  • there are no ways if $n' \neq m$ and $n \neq m'$.