mathpi.net

Matrix Multiplication Calculator

This Matrix Multiplication Calculator reads matrix size, then reads two matrices A and B of the specified size from user, and finds the product of two matrices: (A x B), with step by step calculations.

Enter Matrix Size

Matrix A size: x

Matrix B size: x

Enter matrix A

The matrix appears when you enter the size: m, n.

Enter matrix B

The matrix appears when you enter the size: m, n.

How to do Matrix Multiplication

To multiply two matrices, follow these steps:

1. Determine if the matrices can be multiplied by checking the size requirements.

2. Multiply the rows of the first matrix by the columns of the second matrix to compute the elements of the result matrix.

Consider multiplying two matrices A and B of dimensions 2x2:

Matrix \({\ A = \begin{bmatrix}a_{11} & a_{12}\\a_{21} & a_{22}\end{bmatrix} }\)

Matrix \({\ B = \begin{bmatrix}b_{11} & b_{12}\\b_{21} & b_{22}\end{bmatrix} }\)

The result of multiplying A by B is a new matrix C.

Matrix \({\ C = AB = \begin{bmatrix}a_{11}b_{11} + a_{12}b_{21} & a_{11}b_{12} + a_{12}b_{22}\\a_{21}b_{11} + a_{22}b_{21} & a_{21}b_{12} + a_{22}b_{22}\end{bmatrix} }\)

The following image shows how the rows from first matrix are multiplied with the columns from second matrix.

Matrix Multiplication of 2x2 matrices

Examples of Matrix Multiplication

1. Multiply the following two 2x2 matrices: A and B.

Matrix \({\ A = \begin{bmatrix}1 & 2\\3 & 4\end{bmatrix} }\)

Matrix \({\ B = \begin{bmatrix}5 & 6\\7 & 8\end{bmatrix} }\)

Solution

Given matrices are:

Matrix \({\ A = \begin{bmatrix}1 & 2\\3 & 4\end{bmatrix} }\)

Matrix \({\ B = \begin{bmatrix}5 & 6\\7 & 8\end{bmatrix} }\)

Checking if Matrix Multiplication is possible with Matrices A and B

The columns in matrix A are two and the rows in matrix B are two, which are equal. Therefore, we can do the matrix multiplication with the given two matrices.

Calculating the product of Matrices A and B

\({\ AB = \begin{bmatrix}1×5 + 2×7 & 1×6 + 2×8\\3×5 + 4×7 & 3×6 + 4×8\end{bmatrix} }\)

\({\ AB = \begin{bmatrix}5+14 & 6+16\\15+28 & 18+32\end{bmatrix} }\)

\({\ AB = \begin{bmatrix}19 & 22\\43 & 50\end{bmatrix} }\)

Result of Matrix Multiplication

Therefore, the product of the given matrices A and B is

\({\ AB = \begin{bmatrix}19 & 22\\43 & 50\end{bmatrix} }\)

2. Multiply the following matrices: A(2x3) and B(3x2).

Matrix \({\ A = \begin{bmatrix}1 & 2 &3\\4 & 5 & 6\end{bmatrix} }\)

Matrix \({\ B = \begin{bmatrix}7 & 8\\9 & 10\\11 & 12\end{bmatrix} }\)

Solution

Given matrices are:

Matrix \({\ A = \begin{bmatrix}1 & 2 &3\\4 & 5 & 6\end{bmatrix} }\)

Matrix \({\ B = \begin{bmatrix}7 & 8\\9 & 10\\11 & 12\end{bmatrix} }\)

Checking if Matrix Multiplication is possible with Matrices A and B

The columns in matrix A are three and the rows in matrix B are three, which are equal. Therefore, we can do the matrix multiplication with the given two matrices.

The resulting matrix will have the size of 2x2, because the resulting matrix will have the same number of rows as that of in A which is 2, and the same number of columns as that of in B which is 2.

Calculating the product of Matrices A and B

\({\ AB = \begin{bmatrix}1×7 + 2×9 + 3×11 & 1×8 + 2×10 + 3×12\\4×7 + 5×9 + 6×11 & 4×8 + 5×10 + 6×12\end{bmatrix} }\)

\({\ AB = \begin{bmatrix}7+18+33 & 8+20+36\\28+45+66 & 32+50+72\end{bmatrix} }\)

\({\ AB = \begin{bmatrix}58 & 64\\139 & 154\end{bmatrix} }\)

Result of Matrix Multiplication

Therefore, the product of the given matrices A and B is

\({\ AB = \begin{bmatrix}19 & 22\\43 & 50\end{bmatrix} }\)

3. Multiply the following matrices: A(2x2) and B(3x2).

Matrix \({\ A = \begin{bmatrix}1 & 2\\3 & 4\end{bmatrix} }\)

Matrix \({\ B = \begin{bmatrix}7 & 8\\9 & 10\\11 & 12\end{bmatrix} }\)

Solution

Given matrices are:

Matrix \({\ A = \begin{bmatrix}1 & 2\\3 & 4\end{bmatrix} }\)

Matrix \({\ B = \begin{bmatrix}7 & 8\\9 & 10\\11 & 12\end{bmatrix} }\)

Checking if Matrix Multiplication is possible with Matrices A and B

The columns in matrix A are two and the rows in matrix B are three, which are not equal.

Therefore, the matrix multiplication is not possible for the given matrices.