Matrix Multiplication

Matrix multiplication combines rows from the first matrix with columns of the second to produce a new matrix, useful for solving systems and transformations.

(AB)ij=kaikbkj(AB)_{ij} = \sum_{k} a_{ik} b_{kj}

Solve a problem with Matrix Multiplication

Type the problem. The solver will use Matrix Multiplication where Matrix Multiplication is the right tool, and tell you when it is not.

Drag one in or paste from the clipboard. JPEG, PNG or WebP. You get the transcription to check before anything is solved.

How to get a better answer
  • Paste the whole problem, including the instruction word — "simplify", "solve for x" and "factor" lead to three different answers.
  • Say what you have already tried. "I got x = 4 and the book says 2" turns a solution into a diagnosis.
  • Set the level in the settings button. A calculus shortcut is not a better answer if you have not met derivatives yet.
  • For a photo, get the whole problem in frame and hold the page flat — you get the transcription to fix before anything is solved.

What each symbol means

What Matrix Multiplication takes
AA
BB
ii
jj
kk
Matrix Multiplication
SymbolMeaning
AAMatrix AA is the first (left) matrix in the multiplication; the number of its columns must equal the number of rows in BB, or the multiplication is undefined.
BBMatrix BB is the second (right) matrix in the multiplication; its columns will appear in the columns of the result, and its rows must match AA's columns.
iiThe row index ii tells you which row of matrix AA you are using in the result; it ranges from 1 to the number of rows in AA.
jjThe column index jj tells you which column of matrix BB you are using in the result; it ranges from 1 to the number of columns in BB.
kkThe summation index kk runs through matching pairs of entries—the columns of AA and rows of BB—that get multiplied together and added up.

When to use it

When you need to combine two linear transformations or convert from one coordinate system to another.

Level

Usually taught in: Algebra II

Worked examples

1. Multiply two 2×2 matrices with positive integers

Problem

Multiply the matrices A=(2314)A = \begin{pmatrix} 2 & 3 \\ 1 & 4 \end{pmatrix} and B=(5012)B = \begin{pmatrix} 5 & 0 \\ 1 & 2 \end{pmatrix}.
  1. (AB)1,1=25+31(AB)_{1,1} = 2 \cdot 5 + 3 \cdot 1

    To find entry (1,1), multiply the first row of AA by the first column of BB: multiply the first entries (2 and 5), then the second entries (3 and 1), and add them.

  2. (AB)1,1=10+3=13(AB)_{1,1} = 10 + 3 = 13

    Evaluate the multiplication: 25=102 \cdot 5 = 10 and 31=33 \cdot 1 = 3, then add to get 13.

  3. (AB)1,2=20+32=0+6=6(AB)_{1,2} = 2 \cdot 0 + 3 \cdot 2 = 0 + 6 = 6

    For entry (1,2), use row 1 of AA with column 2 of BB: multiply entries and add.

  4. (AB)2,1=15+41=5+4=9(AB)_{2,1} = 1 \cdot 5 + 4 \cdot 1 = 5 + 4 = 9

    For entry (2,1), use row 2 of AA with column 1 of BB.

  5. (AB)2,2=10+42=0+8=8(AB)_{2,2} = 1 \cdot 0 + 4 \cdot 2 = 0 + 8 = 8

    For entry (2,2), use row 2 of AA with column 2 of BB.

Answer: (13698)\begin{pmatrix} 13 & 6 \\ 9 & 8 \end{pmatrix}

Each entry is formed by the dot product of a row and column, exactly as the definition (AB)ij=kaikbkj(AB)_{ij} = \sum_k a_{ik}b_{kj} states. This systematic process works for any two matrices where the first has as many columns as the second has rows.

2. Multiply two 2×2 matrices with negative entries

Problem

Multiply A=(2134)A = \begin{pmatrix} 2 & -1 \\ 3 & 4 \end{pmatrix} and B=(2153)B = \begin{pmatrix} -2 & 1 \\ 5 & -3 \end{pmatrix}.
  1. (AB)1,1=2(2)+(1)5(AB)_{1,1} = 2 \cdot (-2) + (-1) \cdot 5

    Row 1 of AA times column 1 of BB: be careful with signs when multiplying negatives.

  2. (AB)1,1=45=9(AB)_{1,1} = -4 - 5 = -9

    Compute: 2(2)=42 \cdot (-2) = -4 and (1)5=5(-1) \cdot 5 = -5, so the sum is 4+(5)=9-4 + (-5) = -9.

  3. (AB)1,2=21+(1)(3)=2+3=5(AB)_{1,2} = 2 \cdot 1 + (-1) \cdot (-3) = 2 + 3 = 5

    Row 1 of AA times column 2: (1)(3)=3(-1) \cdot (-3) = 3 (negative times negative is positive).

  4. (AB)2,1=3(2)+45=6+20=14(AB)_{2,1} = 3 \cdot (-2) + 4 \cdot 5 = -6 + 20 = 14

    Row 2 of AA times column 1 of BB: watch the mix of negative and positive products.

  5. (AB)2,2=31+4(3)=312=9(AB)_{2,2} = 3 \cdot 1 + 4 \cdot (-3) = 3 - 12 = -9

    Row 2 of AA times column 2: 4(3)=124 \cdot (-3) = -12, giving 3+(12)=93 + (-12) = -9.

Answer: (95149)\begin{pmatrix} -9 & 5 \\ 14 & -9 \end{pmatrix}

Negative entries in the matrices require careful attention to signs during multiplication and addition. This example shows that the result can have a mix of negative, positive, and repeated values—all determined by applying the definition consistently.

3. Calculate weighted season scoring using team statistics

Problem

A basketball team's two guards (Player A and Player B) scored the following points in three games: Game 1: A scored 14 points, B scored 12 points; Game 2: A scored 18 points, B scored 15 points; Game 3: A scored 16 points, B scored 13 points. The head coach rewards games based on performance bonuses: Game 1 is worth 3 bonus points each, Game 2 is worth 4 bonus points each, Game 3 is worth 5 bonus points each. Use matrix multiplication to calculate the total bonus points earned by each player across all three games.
  1. S=(141816121513),B=(345)S = \begin{pmatrix} 14 & 18 & 16 \\ 12 & 15 & 13 \end{pmatrix}, \quad B = \begin{pmatrix} 3 \\ 4 \\ 5 \end{pmatrix}

    Set up the scoring matrix SS with players as rows and games as columns, and a bonus vector BB with the reward value for each game.

  2. (SB)1=143+184+165(SB)_1 = 14 \cdot 3 + 18 \cdot 4 + 16 \cdot 5

    Player A's bonus is calculated by multiplying the row of A's game scores by the column of bonus values and summing.

  3. (SB)1=42+72+80=194(SB)_1 = 42 + 72 + 80 = 194

    Compute each product: 143=4214 \cdot 3 = 42, 184=7218 \cdot 4 = 72, 165=8016 \cdot 5 = 80, and add to get 194 bonus points.

  4. (SB)2=123+154+135=36+60+65=161(SB)_2 = 12 \cdot 3 + 15 \cdot 4 + 13 \cdot 5 = 36 + 60 + 65 = 161

    Player B's bonus is computed the same way using B's row of scores: 123=3612 \cdot 3 = 36, 154=6015 \cdot 4 = 60, 135=6513 \cdot 5 = 65.

Answer: (194161)\begin{pmatrix} 194 \\ 161 \end{pmatrix}

Matrix multiplication lets us efficiently compute combined rewards for each player across all games at once. Rather than calculating each player's bonus separately, the single multiplication SBSB gives both totals—a demonstration of why matrices are useful for handling multiple data sets simultaneously.

Common mistakes

Where Matrix Multiplication usually goes wrong
Answer came out wrong
(AB)ij=aijbij(AB)_{ij} = a_{ij}b_{ij} (multiplying entry-by-entry)
Use (AB)ij=kaikbkj(AB)_{ij} = \sum_k a_{ik}b_{kj} instead: multiply each element of row ii of AA by the corresponding element of column jj of BB, then add all those products.
AB=BAAB = BA (assuming matrix multiplication is commutative)
Always keep the matrices in the specified order. Only if you are explicitly told the matrices commute (very rare) can you reorder them.
(AB)ij(AB)_{ij} can be computed by multiplying the ii-th row of BB by the jj-th column of AA
Always multiply the ii-th row of AA (the first matrix) by the jj-th column of BB (the second matrix): (AB)ij=kaikbkj(AB)_{ij} = \sum_k a_{ik}b_{kj}.
The mistakeWhy it is wrongThe fix
(AB)ij=aijbij(AB)_{ij} = a_{ij}b_{ij} (multiplying entry-by-entry)Matrix multiplication is not entry-wise multiplication; the definition requires a row from AA and a column from BB, summed together.Use (AB)ij=kaikbkj(AB)_{ij} = \sum_k a_{ik}b_{kj} instead: multiply each element of row ii of AA by the corresponding element of column jj of BB, then add all those products.
AB=BAAB = BA (assuming matrix multiplication is commutative)Swapping the order of matrices almost always gives a different result, or might not even be possible if the dimensions don't line up.Always keep the matrices in the specified order. Only if you are explicitly told the matrices commute (very rare) can you reorder them.
(AB)ij(AB)_{ij} can be computed by multiplying the ii-th row of BB by the jj-th column of AAMatrix multiplication multiplies a row of the first matrix by a column of the second matrix; reversing this gets the indices and matrices wrong.Always multiply the ii-th row of AA (the first matrix) by the jj-th column of BB (the second matrix): (AB)ij=kaikbkj(AB)_{ij} = \sum_k a_{ik}b_{kj}.

Tips and when to use something else

  • Check that the dimensions are compatible before multiplying: if AA is m×nm \times n, then BB must be n×pn \times p, and the result will be m×pm \times p.
  • A common mistake is to confuse matrix multiplication with the Hadamard (element-wise) product, where you would multiply only corresponding entries—make sure you are taking the dot product of rows with columns.
  • If you need to undo a matrix multiplication (solve AB=CAB = C for BB), use matrix inverse or Gaussian elimination instead of dividing, since matrix division is not defined; see Inverse of a 2x2 Matrix.
  • For small examples, write out the full computation of at least the first two entries before filling in the rest, so you catch errors in your understanding early.

Frequently asked questions

Why can't I multiply any two matrices together?
The number of columns in the first matrix must equal the number of rows in the second. This compatibility rule comes from the definition: (AB)ij=kaikbkj(AB)_{ij} = \sum_k a_{ik}b_{kj} requires the index kk to run across the same range in both matrices. If AA is 2×32 \times 3 and BB is 3×43 \times 4, it works (2×42 \times 4 result), but if BB is 4×34 \times 3, the multiplication is undefined.
Is matrix multiplication associative?
Yes—(AB)C=A(BC)(AB)C = A(BC) always holds when all multiplications are defined. However, matrix multiplication is not commutative (ABBAAB \neq BA in general), so you cannot rearrange the order of matrices, only the grouping. This is why writing 'multiply by CC' or 'multiply by AA then by BB' requires specifying which matrix goes on the left.
What happens when I multiply by the identity matrix?
If II is the identity matrix, then AI=AAI = A and IA=AIA = A (the identity is commutative)—multiplying by the identity does nothing, which is exactly what you would want. This is why the identity matrix is the multiplicative identity for matrices.
Can matrix multiplication be undone?
If AB=CAB = C and you want to solve for BB, you cannot simply divide by AA (matrix division is undefined). Instead, you can multiply both sides by A1A^{-1} if it exists: B=A1CB = A^{-1}C. If AA is not invertible, there may be no unique solution or no solution at all; use Gaussian elimination for a more complete analysis.

Need a different method?

The full solver is not scoped to one formula — type any problem and it will pick the method.

Open the math solver

Reviewed 2026-09-18