MathCalcs

Matrix Multiplication Calculator

Matrix A

Matrix B

Result Matrix

Matrix Multiplication Calculator

Use this mathcalcs matrix multiplication calculator to find the product of two matrices. Use the tool above to multiply two matrices and get the product matrix.

How to use the matrix multiplication calculator

To use the matrix multiplication calculator, follow these steps:

  • In the first input, enter the number of rows for the first matrix.
  • In the second input, enter the number of columns for the first matrix.
  • In the third input, enter the number of rows for the second matrix.
  • In the fourth input, enter the number of columns for the second matrix.
  • Enter the elements of the first matrix row by row.
  • Enter the elements of the second matrix row by row.
  • Click on the "Calculate" button to get the product matrix.

What is Matrix Multiplication?

Matrix multiplication is a matrix operation that takes two matrices and produces a new matrix. The new matrix is called the product of the two matrices. The new matrix's elements are calculated by using the elements of the original matrices according to a specific formula.

Matrix Multiplication Rules

For two matrices A and B to be multiplied (A * B), the number of columns in the Matrix A should be equal to number of rows in the Matrix B. The resulting matrix will have the row count of Matrix A and the column count of the Matrix B

How to do Matrix Multiplication?

To perform matrix multiplication of two matrices M and N, follow these steps:

  1. Check if the number of columns in the matrix M = number of rows in Matrix N

If this condition is met ✅, proceed to the next step.

Let M and N be matrices with following elements

\(M = \begin{bmatrix} a & b \\ c & d \end{bmatrix} N = \begin{bmatrix} e & f \\ g & h \end{bmatrix} \)

The product of M and N (M * N ) will be a matrix P with following elements

\(P = \begin{bmatrix} a \cdot e + b \cdot g & a \cdot f + b \cdot h \\ c \cdot e + d \cdot g & c \cdot f + d \cdot h \end{bmatrix} \)

What we did is to form the element of the resulting matrix P and index (1,1)

  • We took first row of M (a b) and first column of N (e g)
  • Multiplied the corresponding element (a _ e) and (b _ g) and added them
  • This is the element at index (1,1) of the resulting matrix P

Similarly, we can calculate the element at index (1,2) of the resulting matrix P

  • We took first row of M (a b) and second column of N (f h)
  • Multiplied the corresponding element (a _ f) and (b _ h) and added them
  • This is the element at index (1,2) of the resulting matrix P

This is how we calculate the elements of the resulting matrix P

Matrix Multiplication Formula

The formula for matrix multiplication is as follows:

\(P_{ij} = \sum_{k} (M_{ik} \cdot N_{kj}) \)

Where:

  • P is the resulting matrix
  • M is the first matrix
  • N is the second matrix
  • i is the row index of the resulting matrix
  • j is the column index of the resulting matrix

FAQs

Is Matrix Multiplication Commutative?

Matrix Multiplication is not commutative.

It means M * N is not equal to N * M

Sometimes, M * N is defined and N * M may not be defined (because of the dimensions of the matrices)

Matrix Multiplication Examples

Example 1

Let's multiply the following 2 x 2 matrices

\(K = \begin{bmatrix} 24 & 56 \\ 12 & 34 \end{bmatrix} L = \begin{bmatrix} 23 & 45 \\ 67 & 89 \end{bmatrix} \)
\( K \cdot L = \begin{bmatrix} 24 \times 23 + 56 \times 67 & 24 \times 45 + 56 \times 89 \\ 12 \times 23 + 34 \times 67 & 12 \times 45 + 34 \times 89 \end{bmatrix} = \begin{bmatrix} 4304 & 6064 \\ 2554 & 3566 \end{bmatrix} \)

Example 2

Let's multiply the following 2 x 3 matrix with a 3 x 2 matrix

\(M = \begin{bmatrix} 34 & 78 & 32 \\ 42 & 87 & 32 \end{bmatrix} N = \begin{bmatrix} 88 & 45 \\ 23 & -34 \\ 12 & 35 \end{bmatrix} \)

M * N = ?

\( M \cdot N = \begin{bmatrix} 34 \times 88 + 78 \times 23 + 32 \times 12 & 34 \times 45 + 78 \times (-34) + 32 \times 35 \\ 42 \times 88 + 87 \times 23 + 32 \times 12 & 42 \times 45 + 87 \times (-34) + 32 \times 35 \end{bmatrix} = \begin{bmatrix} 5202 & -2 \\ 6113 & 52 \end{bmatrix} \)

M 2 x 3 * N 3 x 2 = P 2 x 2

Math Calcs

A playground of Linear Algebra Resources and Tutorials

©2024. All Rights Reserved