Combining Rows and Columns to Form a Product
Matrix multiplication combines each row of the first matrix with each column of the second by multiplying each paired entry and summing the products. Unlike matrix addition, it does not operate on entries in matching positions.
Condition for Matrix Multiplication
Two matrices, say matrix and matrix , can be multiplied () only if the number of columns in matrix is equal to the number of rows in matrix .
Suppose matrix has an order of (meaning rows and columns) and matrix has an order of (meaning rows and columns).
Since the number of columns in matrix () is equal to the number of rows in matrix (), then matrix and can be multiplied.
The result of the multiplication, call it matrix , will have an order of .
The dimension check fits in one line: and imply . The shared inner dimension is consumed by each dot product, while the outer dimensions and determine the result.
How to Calculate the Elements of the Resultant Matrix
The element in matrix (i.e., the element in the -th row and -th column) is calculated by multiplying each element in the -th row of matrix by the corresponding element in the -th column of matrix , and then summing all these products.
Mathematically, if and , then the element of matrix is:
The notation (sigma) means summation.
In the formula above, we sum the products for all values of from to .
Steps to Multiply Matrices
In the following example, each entry of matrix is the dot product of one row of matrix and one column of matrix .
The two matrices are:
Matrix has an order of and matrix also has an order of . The number of columns in (which is ) is equal to the number of rows in (which is ), so we can multiply them. The result, , will have an order of .
The elements of matrix are calculated as follows:
Example of Multiplying Two Matrices
Given two matrices:
Matrix has an order of and matrix has an order of .
The number of columns in matrix (which is ) is equal to the number of rows in matrix (which is ).
So, can be calculated and will result in a matrix of order .
Calculate :
So, the result of the matrix multiplication is:
Now, what about ?
Matrix has an order of and matrix has an order of .
The number of columns in matrix (which is ) is not equal to the number of rows in matrix (which is ).
is undefined. Whether a matrix product exists can change when the factors are reversed.
Properties of Matrix Multiplication
Matrix multiplication satisfies the following rules:
-
Generally Not Commutative:
This means . We have already seen an example above where is defined but is not. Even if both are defined, the results are not necessarily the same.
-
Associative:
If the products on both sides are defined, then holds. This means the order of grouping the multiplication does not change the final result.
-
Distributive:
Matrix multiplication is distributive over matrix addition or subtraction:
This holds if all involved addition and multiplication operations are defined.
-
Multiplication by Identity Matrix ():
If has dimensions , then the left identity has dimensions and the right identity has dimensions :
The identity matrix acts like the number in ordinary number multiplication.
-
Multiplication by a Scalar ():
If is a scalar (real number), then:
Calculating Revenue
Matrix multiplication can combine a table of quantities with a compatible table of prices. The row and column labels determine which quantities are multiplied and added, so matching dimensions alone is not enough.
Suppose a home business sells tempeh chips, banana chips, and potato chips at Place A, Place B, and Place C.
The sales matrix uses product types as rows and places as columns. In other words, each entry of records how many jars of one product were sold at one place.
From top to bottom, the rows represent tempeh chips, banana chips, and potato chips:
The first row () means that jars of tempeh chips were sold at Place A, at Place B, and at Place C.
The price per jar, in rupiah, is stored in the column matrix using the same product order:
From top to bottom, the entries give the prices of tempeh chips, banana chips, and potato chips.
The product is numerically defined because both inner dimensions are , but it is not meaningful here. The columns of represent places, while the rows of represent products. Those labels do not match.
To calculate revenue by place, transpose the price vector and multiply by . The product pairs each product price with the sales of that same product.
Matrix has dimensions , and has dimensions . Therefore has dimensions , with one entry for each place.
.
This means the total revenue from Place A is , from Place B is , and from Place C is .
Revenue by product requires a different multiplication. First use a vector of ones to total each row of , then multiply those totals by the diagonal price matrix derived from .
Matrix therefore gives product revenue: for tempeh chips, for banana chips, and for potato chips.
A meaningful matrix product needs matching dimensions and must pair quantities that describe the same category in the same order.
Here, and produce revenue by place in , while the diagonal price matrix and product totals produce revenue by product in . Those are different questions, so they require different products.
Exercises
Given the following matrices:
Determine the matrices and .
Is ?
Worked Solutions
-
Calculating :
Matrix has an order of and has an order of . The result will have an order of .
Compute each entry by multiplying a row by a column:
-
Calculating :
Matrix has an order of and has an order of . The result will have an order of .
Compute each entry by multiplying a row by a column:
The two products differ, so . Matrix multiplication is not commutative in this example.