Program to find the product of two matricesExplanationIn this program, we need to multiply two matrices and print the resulting matrix. Product of two matricesThe product of two matrices can be computed by multiplying elements of the first row of the first matrix with the first column of the second matrix then, add all the product of elements. Continue this process until each row of the first matrix is multiplied with each column of the second matrix. Consider above example, first element in resulting matrix prod[0,0] can be computed by multiplying first row of first matrix i.e. (1, 3, 2) with first column of second matrix i.e. (2, 1, 1) and finally sum all the product of elements i.e. (1*2) + (3*1) + (2*1) = 7. Similarly, second entry prod[0,1] can be computed by multiplying the first row of the first matrix with the second column of the second matrix and sum all the product. Two matrices can be multiplied if and only if they satisfy the following condition: the number of columns present in the first matrix should be equal to the number of rows present in the second matrix. Suppose dimension of matrix A is p × q and matrix B is q × r, then the dimension of resulting matrix will be p × r. Matrix multiplication can be represented as C_{ij} = Σ A_{ik}B_{kj} Algorithm
SolutionPythonOutput: Product of two matrices: 7 7 6 8 6 5 6 7 5 COutput: Product of two matrices: 7 7 6 8 6 5 6 7 5 JAVAOutput: Product of two matrices: 7 7 6 8 6 5 6 7 5 C#Output: Product of two matrices: 7 7 6 8 6 5 6 7 5 PHPOutput: Product of two matrices: 7 7 6 8 6 5 6 7 5
Next Topic#

IoT
GraphQL
Xampp
Kivy
A. Anywhere
Ext.js
UiPath
Arduino
Digital E.
Adwords
MySQL
Python
Smartsheet
Affiliate M.