HexMathv1.0.4

Matrix multiplication calculator

This matrix multiplication calculator multiplies two matrices, or a matrix and a column vector. Type the matrices or scan them from a photo. HexMath first checks that the sizes match, then returns the product matrix and shows how each entry is found as one row times one column, for integers, fractions, decimals or letters.

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 (see the inverse matrix calculator) and determinants (see the matrix 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: Multiply [2, 1; 0, 3][1, 4; 2, -1].

Problem

Multiply (2103)(142−1)\displaystyle \begin{pmatrix}2 & 1\\ 0 & 3\end{pmatrix}\begin{pmatrix}1 & 4\\ 2 & -1\end{pmatrix}.

Answer

Verified

The answer is

(476−3)\begin{pmatrix}4 & 7\\ 6 & -3\end{pmatrix}

Explanation

  1. Check the sizes
    A 2×22 \times 2 times a 2×22 \times 2 gives a 2×22 \times 2. Each entry is a row of the first matrix times a column of the second.
  2. First row of the result
    Row (2,1)(2, 1) times column (1,2)(1, 2): 2⋅1+1⋅2=42 \cdot 1 + 1 \cdot 2 = 4. Row (2,1)(2, 1) times column (4,−1)(4, -1)
    2⋅4+1⋅(−1)=72 \cdot 4 + 1 \cdot (-1) = 7
  3. Second row of the result
    Row (0,3)(0, 3) times column (1,2)(1, 2): 0⋅1+3⋅2=60 \cdot 1 + 3 \cdot 2 = 6. Row (0,3)(0, 3) times column (4,−1)(4, -1)
    0⋅4+3⋅(−1)=−30 \cdot 4 + 3 \cdot (-1) = -3
  4. Assemble
    (476−3)\begin{pmatrix}4 & 7\\ 6 & -3\end{pmatrix}.

Example 2: With the same matrices, find BA.

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: Multiply [2, -1, 0; 1, 3, 2; 0, 1, 4] by the column vector [1; 2; -1].

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 example in the solver above 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.
  • HexMath 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.

When the number of columns of the first matrix differs from the number of rows of the second. The first step checks the sizes, so you see at once when the product is not defined.

Ready to solve your next math problem?

Create a free account for 3 math questions a day in your browser. No card.

Get HexMath on your phone

The same solver and camera scan on iPhone and Android.

Last updated: · HexMath