Matrices (tables with numeric elements) can be used for various calculations. Some of them are multiplication by a number, a vector, another matrix, several matrices. The product is sometimes incorrect. An erroneous result is the result of ignorance of the rules for performing computational actions. Let's figure out how to do multiplication.
Matrix and number
Let's start with the simplest thing - multiplying a table with numbers by a specific value. For example, we have a matrix A with elements aij (i are the row numbers and j are the column numbers) and the number e. The product of the matrix by the number e will be the matrix B with the elements bij, which are found by the formula:
bij=e × aij.
T. e. to get the element b11 you need to take the element a11 and multiply it by the desired number, to get b12 it is required to find the product of the element a12 and the number e, etc.
Let's solve the problem number 1 presented in the picture. To get matrix B, simply multiply the elements from A by 3:
- a11 × 3=18. We write this value into matrix B at the place where column No. 1 and row No. 1 intersect.
- a21 × 3=15. We got element b21.
- a12 × 3=-6. We received the element b12. We write it into matrix B at the place where column 2 and row 1 intersect.
- a22 × 3=9. This result is element b22.
- a13 × 3=12. Enter this number into the matrix in place of the element b13.
- a23 × 3=-3. The last number received is element b23.
Thus, we got a rectangular array with numeric elements.
18 | –6 | 12 |
15 | 9 | –3 |
Vectors and the condition for the existence of a product of matrices
In mathematical disciplines, there is such a thing as a "vector". This term refers to an ordered set of values from a1 to a . They are called vector space coordinates and are written as a column. There is also the term "transposed vector". Its components are arranged as a string.
Vectors can be called matrices:
- column vector is a matrix built from one column;
- row vector is a matrix that includes only one row.
When doneover matrices of multiplication operations, it is important to remember that there is a condition for the existence of a product. The computational action A × B can only be performed when the number of columns in table A is equal to the number of rows in table B. The resulting matrix resulting from the calculation always has the number of rows in table A and the number of columns in table B.
When multiplying, it is not recommended to rearrange matrices (multipliers). Their product usually does not correspond to the commutative (displacement) law of multiplication, i.e. the result of the operation A × B is not equal to the result of the operation B × A. This feature is called the non-commutativity of the product of matrices. In some cases, the result of the multiplication A × B is equal to the result of the multiplication B × A, i.e., the product is commutative. Matrices for which the equality A × B=B × A holds are called permutation matrices. See examples of such tables below.
Multiplication by a column vector
When multiplying a matrix by a column vector, we must take into account the condition for the existence of the product. The number of columns (n) in the table must match the number of coordinates that make up the vector. The result of the calculation is the transformed vector. Its number of coordinates is equal to the number of lines (m) from the table.
How are the coordinates of the vector y calculated if there is a matrix A and a vector x? For calculations created formulas:
y1=a11x1 + a12 x2 + … + a1 x , y2=a21x1 + a22x2 + … + a 2nx ,
…………………………………, ym=am1x1 + am2 x2 + … + amnx ,
where x1, …, x are coordinates from the x-vector, m is the number of rows in the matrix and the number of coordinates in the new y- vector, n is the number of columns in the matrix and the number of coordinates in the x-vector, a11, a12, …, amn– elements of matrix A.
Thus, to obtain the i-th component of the new vector, the scalar product is performed. The i-th row vector is taken from the matrix A, and it is multiplied by the available vector x.
Let's solve problem 2. You can find the product of a matrix and a vector because A has 3 columns and x consists of 3 coordinates. As a result, we should get a column vector with 4 coordinates. Let's use the above formulas:
- Compute y1. 1 × 4 + (–1) × 2 + 0 × (–4). The final value is 2.
- Compute y2. 0 × 4 + 2 × 2 + 1 × (–4). When calculating, we get 0.
- Compute y3. 1 × 4 + 1 × 2 + 0 × (–4). The sum of the products of the indicated factors is 6.
- Compute y4. (–1) × 4 + 0 × 2 + 1 × (–4). The coordinate is -8.
Row vector-matrix multiplication
You cannot multiply a matrix with multiple columns by a row vector. In such cases, the condition for the existence of the work is not satisfied. But multiplication of a row vector by a matrix is possible. Thisthe computational operation is performed when the number of coordinates in the vector and the number of rows in the table match. The result of the product of a vector and a matrix is a new row vector. Its number of coordinates must equal the number of columns in the matrix.
Computing the first coordinate of a new vector involves multiplying the row vector and the first column vector from the table. The second coordinate is calculated in a similar way, but instead of the first column vector, the second column vector is taken. Here is the general formula for calculating coordinates:
yk=a1kx1+ a2kx2 + … + amkx m, where yk is a coordinate from the y-vector, (k is between 1 and n), m is the number of rows in the matrix and the number of coordinates in the x-vector, n is the number of columns in the matrix and the number of coordinates in the y-vector, a with alphanumeric indices are the elements of the matrix A.
Product of rectangular matrices
This calculation may seem complicated. However, multiplication is easily done. Let's start with a definition. The product of a matrix A with m rows and n columns and a matrix B with n rows and p columns is a matrix C with m rows and p columns, in which the element cij is the sum of the products of the elements i- th row from table A and j-th column from table B. In simpler terms, the element cij is the scalar product of the i-th row vector from table A and the j-th column vector from table B.
Now let's figure out in practice how to find the product of rectangular matrices. Let's solve problem No. 3 for this. The condition for the existence of a product is satisfied. Let's start calculating the elements cij:
- Matrix C will have 2 rows and 3 columns.
- Calculate element c11. To do this, we perform the scalar product of row No. 1 from matrix A and column No. 1 from matrix B. c11=0 × 7 + 5 × 3 + 1 × 1=16. Then we proceed in a similar way, changing only rows, columns (depending on element index).
- c12=12.
- c13=9.
- c21=31.
- c22=18.
- c23=36.
The elements are calculated. Now it remains only to make a rectangular block of the received numbers.
16 | 12 | 9 |
31 | 18 | 36 |
Multiplication of three matrices: the theoretical part
Can you find the product of three matrices? This computational operation is feasible. The result can be obtained in several ways. For example, there are 3 square tables (of the same order) - A, B and C. To calculate the product, you can:
- Multiply A and B first. Then multiply the result by C.
- First find the product of B and C. Then multiply matrix A by the result.
If you need to multiply rectangular matrices, then first you need to make sure that this computational operation is possible. Shouldproducts A × B and B × C exist.
Incremental multiplication is not a mistake. There is such a thing as "associativity of matrix multiplication". This term refers to the equality (A × B) × C=A × (B × C).
Three Matrix Multiplication Practice
Square matrices
Start by multiplying small square matrices. The figure below shows the problem number 4, which we have to solve.
We will use the associativity property. First we multiply either A and B, or B and C. We remember only one thing: you can’t swap factors, that is, you can’t multiply B × A or C × B. With this multiplication, we will get an erroneous result.
Decision progress.
Step one. To find the common product, we first multiply A by B. When multiplying two matrices, we will be guided by the rules that were outlined above. So, the result of multiplying A and B will be a matrix D with 2 rows and 2 columns, i.e. a rectangular array will include 4 elements. Let's find them by doing the calculation:
- d11=0 × 1 + 5 × 6=30;
- d12=0 × 4 + 5 × 2=10;
- d21=3 × 1 + 2 × 6=15;
- d22=3 × 4 + 2 × 2=16.
Intermediate result ready.
30 | 10 |
15 | 16 |
Step two. Now let's multiply matrix D by matrix C. The result should be a square matrix G with 2 rows and 2 columns. Calculate elements:
- g11=30 × 8 + 10 × 1=250;
- g12=30 × 5 + 10 × 3=180;
- g21=15 × 8 + 16 × 1=136;
- g22=15 × 5 + 16 × 3=123.
Thus, the result of the product of square matrices is a table G with calculated elements.
250 | 180 |
136 | 123 |
Rectangular matrices
The figure below shows problem number 5. It is required to multiply rectangular matrices and find a solution.
Let's check whether the condition for the existence of products A × B and B × C is satisfied. The orders of the indicated matrices allow us to perform multiplication. Let's start solving the problem.
Decision progress.
Step one. Multiply B by C to get D. Matrix B has 3 rows and 4 columns, and matrix C has 4 rows and 2 columns. This means that we will get a matrix D with 3 rows and 2 columns. Let's calculate the elements. Here are 2 calculation examples:
- d11=3 × 0 + 0 × 0 + 1 × 0 + 0 × 1=0;
- d12=3 × 2 + 0 × 3 + 1 × 1 + 0 × 6=7.
We continue to solve the problem. As a result of further calculations, we find the values d21, d22, d31 and d32. These elements are 0, 19, 1 and 11 respectively. Let's write the found values into a rectangular array.
0 | 7 |
0 | 19 |
1 | 11 |
Step two. Multiply A by D to get the final matrix F. It will have 2 rows and 2 columns. Calculate elements:
- f11=2 × 0 + 6 × 0 + 1 × 1=1;
- f12=2 × 7 + 6 × 19 + 1 × 11=139;
- f21=0 × 0 + 1 × 0 + 3 × 1=3;
- f22=0 × 7 + 1 × 19 + 3 × 11=52.
Compose a rectangular array, which is the end result of multiplying three matrices.
1 | 139 |
3 | 52 |
Introduction to direct work
Quite difficult to understand material is the Kronecker product of matrices. It also has an additional name - a direct work. What is meant by this term? Let's say we have table A of order m × n and table B of order p × q. The direct product of matrix A and matrix B is a matrix of order mp × nq.
We have 2 square matrices A, B, which are shown in the picture. The first one has 2 columns and 2 rows, and the second has 3 columns and 3 rows. We see that the matrix resulting from the direct product consists of 6 rows and exactly the same number of columns.
How are elements of a new matrix calculated in a direct product? Finding the answer to this question is very easy if you analyze the picture. First fill in the first line. Take the first element from the top row of table A and sequentially multiply by the elements of the first rowfrom table B. Next, take the second element of the first row of table A and sequentially multiply by the elements of the first row of table B. To fill the second row, take the first element from the first row of table A again and multiply it by the elements of the second row of table B.
The final matrix obtained by direct product is called a block matrix. If we analyze the figure again, we can see that our result consists of 4 blocks. All of them include elements of matrix B. Additionally, an element of each block is multiplied by a specific element of matrix A. In the first block, all elements are multiplied by a11, in the second - by a12, in the third - on a21, in the fourth - on a22.
Product determinant
When considering the topic of matrix multiplication, it is worth considering such a term as “the determinant of the product of matrices”. What is a determinant? This is an important characteristic of a square matrix, a certain value that is assigned to this matrix. The literal designation of the determinant is det.
For a matrix A consisting of two columns and two rows, the determinant is easy to find. There is a small formula that is the difference between the products of specific elements:
det A=a11 × a22 – a12 × a21.
Let's consider an example of calculating the determinant for a second-order table. There is a matrix A in which a11=2, a12=3, a21=5 and a 22=1. To calculate the determinant, use the formula:
det A=2 × 1 – 3 × 5=2 – 15=–13.
For 3 × 3 matrices, the determinant is calculated using a more complex formula. It is presented below for matrix A:
det A=a11a22a33 + a12 a23a31 + a13a21a 32 – a13a22a31 – a11 a23a32 – a12a21 a33.
To remember the formula, we came up with the triangle rule, which is illustrated in the picture. First, the elements of the main diagonal are multiplied. The products of those elements indicated by the angles of triangles with red sides are added to the obtained value. Next, the product of the elements of the secondary diagonal is subtracted and the products of those elements indicated by the corners of triangles with blue sides are subtracted.
Now let's talk about the determinant of the product of matrices. There is a theorem that says that this indicator is equal to the product of the determinants of the multiplier tables. Let's verify this with an example. We have matrix A with entries a11=2, a12=3, a21=1 and a 22=1 and matrix B with entries b11=4, b12=5, b 21=1 and b22=2. Find the determinants for the matrices A and B, the product A × B and the determinant of this product.
Decision progress.
Step one. Calculate the determinant for A: det A=2 × 1 – 3 × 1=–1. Next, calculate the determinant for B: det B=4 × 2 – 5 × 1=3.
Step two. Let's findproduct A × B. Denote the new matrix by the letter C. Calculate its elements:
- c11=2 × 4 + 3 × 1=11;
- c12=2 × 5 + 3 × 2=16;
- c21=1 × 4 + 1 × 1=5;
- c22=1 × 5 + 1 × 2=7.
Step three. Calculate the determinant for C: det C=11 × 7 – 16 × 5=–3. Compare with the value that could be obtained by multiplying the determinants of the original matrices. The numbers are the same. The above theorem is true.
Product rank
The rank of a matrix is a characteristic that reflects the maximum number of linearly independent rows or columns. To calculate the rank, elementary transformations of the matrix are performed:
- rearrangement of two parallel rows;
- multiplying all elements of a certain row from the table by a non-zero number;
- adding to the elements of one row of elements from another row, multiplied by a specific number.
After elementary transformations, look at the number of non-zero strings. Their number is the rank of the matrix. Consider the previous example. It presented 2 matrices: A with elements a11=2, a12=3, a21=1 and a22 =1 and B with elements b11=4, b12=5, b 21=1 and b22=2. We will also use the matrix C obtained as a result of multiplication. If we perform elementary transformations, then there will be no zero rows in the simplified matrices. This means that both the rank of table A, and the rank of table B, and the ranktable C is 2.
Now let's pay special attention to the rank of the product of matrices. There is a theorem that says that the rank of a product of tables containing numeric elements does not exceed the rank of any of the factors. This can be proven. Let A be a k × s matrix and B be an s × m matrix. The product of A and B is equal to C.
Let's study the picture above. It shows the first column of matrix C and its simplified notation. This column is a linear combination of the columns included in the matrix A. Similarly, we can say about any other column from the rectangular array C. Thus, the subspace formed by the column vectors of the table C is in the subspace formed by the column vectors of the table A. By this Therefore, the dimension of subspace No. 1 does not exceed the dimension of subspace No. 2. This implies that the rank in columns of table C does not exceed the rank in columns of table A, i.e., r(C) ≦ r(A). If we argue in a similar way, then we can make sure that the rows of the matrix C are linear combinations of the rows of the matrix B. This implies the inequality r(C) ≦ r(B).
How to find the product of matrices is a rather complicated topic. It can be easily mastered, but to achieve such a result, you will have to spend a lot of time memorizing all the existing rules and theorems.