Language Reference


Multiplication Operator, Matrix:   *

  • matrix1 * matrix2;

The matrix multiplication operator (*) computes a new matrix by performing matrix multiplication. The first matrix must have the same number of columns as the second matrix has rows. The new matrix has the same number of rows as the first matrix and the same number of columns as the second matrix. That is, if $\mb{A}$ is an $n\times p$ matrix and $\mb{B}$ is a $p\times m$ matrix, then the product $A*B$ is an $n\times m$ matrix. The $ij$th element of the product is the sum $\sum _{k=1}^ p A_{ik}B_{kj}$.

The matrix multiplication operator does not support missing values.

The following statements multiply matrices. The results are shown in Figure 24.21.

a = {1 2,
     3 4};
b = {1 2};
c = b*a;
d = a*b`;
print c, d;

Figure 24.21: Result of Matrix Multiplication

c
7 10

d
5
11