Matrix multiplication calculator

Type or scan two matrices. MathBuddy multiplies them, one row times one column at a time.

Loading math input...

What this page covers

  • Products of square and rectangular matrices, when the inner sizes match.
  • A matrix times a column vector.
  • Entries that are integers, fractions, decimals or letters.
  • Not covered here: the inverse of a matrix (use Inverse matrix calculator) and determinants (use Determinant calculator).

How to enter the problem

  • Type it or paste it. Write each matrix row by row, for example [[2, 1], [0, 3]], or use the math keyboard's matrix key, and put the two matrices side by side.
  • Scan it. Fit the one problem in the frame.
  • Choose a photo. Several problems in one photo are solved as a list.
  • Then tap Solve.

Worked examples

Example 1

Problem

Find AB\displaystyle AB for A=(102−131)\displaystyle A = \begin{pmatrix}1 & 0 & 2\\ -1 & 3 & 1\end{pmatrix} and B=(312110)\displaystyle B = \begin{pmatrix}3 & 1\\ 2 & 1\\ 1 & 0\end{pmatrix}.

Answer

Verified

The answer is

(5142)\begin{pmatrix}5 & 1\\ 4 & 2\end{pmatrix}

Explanation

  1. Check the sizes
    AA is 2×32 \times 3 and BB is 3×23 \times 2. The inner sizes match (3 and 3), so ABAB is 2×22 \times 2.
  2. First row of A times each column of B
    1⋅3+0⋅2+2⋅1=51 \cdot 3 + 0 \cdot 2 + 2 \cdot 1 = 5 and 1⋅1+0⋅1+2⋅0=11 \cdot 1 + 0 \cdot 1 + 2 \cdot 0 = 1.
  3. Second row of A times each column of B
    −1⋅3+3⋅2+1⋅1=4-1 \cdot 3 + 3 \cdot 2 + 1 \cdot 1 = 4 and −1⋅1+3⋅1+1⋅0=2-1 \cdot 1 + 3 \cdot 1 + 1 \cdot 0 = 2.
  4. Write the product
    Place each result in the row of AA and the column of BB it came from.

Example 2

Problem

With the same matrices, find BA\displaystyle BA.

Answer

Verified

The answer is

(237135102)\begin{pmatrix}2 & 3 & 7\\ 1 & 3 & 5\\ 1 & 0 & 2\end{pmatrix}

Explanation

  1. Check the sizes
    BB is 3×23 \times 2 and AA is 2×32 \times 3, so BABA is 3×33 \times 3. It is a different size from ABAB.
  2. First row of B
    (3,1)(3, 1) times the columns of AA: 3−1=23 - 1 = 2, 0+3=30 + 3 = 3, 6+1=76 + 1 = 7.
  3. Second row of B
    (2,1)(2, 1): 2−1=12 - 1 = 1, 0+3=30 + 3 = 3, 4+1=54 + 1 = 5.
  4. Third row of B
    (1,0)(1, 0): 11, 00, 22.

Example 3

Problem

Multiply (2−10132014)\displaystyle \begin{pmatrix}2 & -1 & 0\\ 1 & 3 & 2\\ 0 & 1 & 4\end{pmatrix} by the column vector (12−1)\displaystyle \begin{pmatrix}1\\ 2\\ -1\end{pmatrix}.

Answer

Verified

The answer is

(05−2)\begin{pmatrix}0\\ 5\\ -2\end{pmatrix}

Explanation

  1. Check the sizes
    A 3×33 \times 3 matrix times a 3×13 \times 1 vector gives a 3×13 \times 1 vector.
  2. Row 1
    2⋅1+(−1)⋅2+0⋅(−1)=02 \cdot 1 + (-1) \cdot 2 + 0 \cdot (-1) = 0
  3. Row 2
    1⋅1+3⋅2+2⋅(−1)=51 \cdot 1 + 3 \cdot 2 + 2 \cdot (-1) = 5
  4. Row 3
    0⋅1+1⋅2+4⋅(−1)=−20 \cdot 1 + 1 \cdot 2 + 4 \cdot (-1) = -2

Common mistakes

  • Multiplying matching entries instead of rows by columns. For the runnable example that would make the top-left entry 2⋅1=22 \cdot 1 = 2 instead of 44.
  • Assuming AB=BAAB = BA. Matrix multiplication is not commutative, and the two products can even have different sizes.
  • Multiplying when the inner sizes do not match. A 2×32 \times 3 matrix cannot be multiplied by a 2×32 \times 3 matrix.
  • Putting a result in the wrong place. The entry in row ii, column jj comes from row ii of the first matrix and column jj of the second.

Checks, assumptions and limits

  • Check one entry by hand. Pick any position, multiply that row of the first matrix by that column of the second, and compare.
  • The product ABAB exists only when the number of columns of AA equals the number of rows of BB. The result has the rows of AA and the columns of BB.
  • MathBuddy can make mistakes. Double check important steps.

Frequently asked questions

Each entry of AB uses rows of A and columns of B. Swapping the order uses different rows and columns, so BA is usually a different matrix, or a different size.

Yes. Write the vector as a column, one entry per row. The result is a vector with one entry per row of the matrix.

Yes. Use the camera on the one problem, or choose a photo. Several problems in one photo are solved as a list.

1 math question to try today without signing in, 3 a day signed in, unlimited with Pro.

Ready to solve your next math problem?

Try one problem free in your browser. Create a free account for 3 math questions a day.

Last updated: · MathBuddy