Instruction
1
By definition, the matrix C, the product of matrices A and B consists of elements[i,j], each of which is equal to the sum of products of elements of row i of the matrix A by the corresponding elements of column j of matrix B. This can be written by formula. The formula takes into account that the matrix A has dimension m x p and matrix B is p x n. Then the matrix C will have the dimension m x n.
2
Let's consider an example. Multiply the matrices A and B indicated in the figure. Consistently we find all the elements of the matrix C = AB.
[1,1] = a[1,1]*b[1,1] + a[1,2]*b[2,1] + a[1,3]*b[3,1] = 3*2 + 2*5 + 0*3 = 16
c[1,2] = a[1,1]*b[1,2] + a[1,2]*b[2,2] + a[1,3]*b[3,2] = 3*1 + 2*4 + 0*2 = 11
c[2,1] = a[2,1]*b[1,1] + a[2,2]*b[2,1] + a[2,3]*b[3,1] = 1*2 + 3*5 + 1*3 = 20
c[2,2] = a[2,1]*b[1,2] + a[2,2]*b[2,2] + a[2,3]*b[3,2] = 1*1 + 3*4 + 1*2 = 15
[1,1] = a[1,1]*b[1,1] + a[1,2]*b[2,1] + a[1,3]*b[3,1] = 3*2 + 2*5 + 0*3 = 16
c[1,2] = a[1,1]*b[1,2] + a[1,2]*b[2,2] + a[1,3]*b[3,2] = 3*1 + 2*4 + 0*2 = 11
c[2,1] = a[2,1]*b[1,1] + a[2,2]*b[2,1] + a[2,3]*b[3,1] = 1*2 + 3*5 + 1*3 = 20
c[2,2] = a[2,1]*b[1,2] + a[2,2]*b[2,2] + a[2,3]*b[3,2] = 1*1 + 3*4 + 1*2 = 15
Note
Square matrices can be multiplied in any order, but the result AB is different from BA.
If one of the matrices is diagonal and the elements on its diagonal are equal, then in this case, multiply it by the square of any corresponding dimension of commutative: AD = DA.
If one of the matrices is diagonal and the elements on its diagonal are equal, then in this case, multiply it by the square of any corresponding dimension of commutative: AD = DA.