Matrix products

Multiply matrices row by column

Set the dimensions of A and B, enter each value, and calculate AB. The calculator checks compatibility and shows how every result entry is formed.

Enter matrix A and matrix B

Matrix A

2 × 3

Matrix B

3 × 2

Compatible: columns(A) = 3 and rows(B) = 3. The product will be 2 × 2.

The product AB is a 2 by 2 matrix

[5864139154]\begin{bmatrix}58 & 64 \\ 139 & 154\end{bmatrix}
Conditions
  • A has dimensions 2 by 3 and B has dimensions 3 by 2.
  • The inner dimensions match: columns(A) = 3 = rows(B).

Steps

  1. Check the dimensions A is 2 by 3 and B is 3 by 2, so AB exists and will be 2 by 2.(2×3)(3×2)2×2(2\times3)(3\times2)\longrightarrow2\times2
  2. Calculate the first result entry Multiply row 1 of A by column 1 of B and add the products.c11=1(7)+2(9)+3(11)=58c_{11}=1(7)+2(9)+3(11)=58
  3. Repeat for every row and column pair Each output position uses one row of A and one column of B.AB=[5864139154]AB=\begin{bmatrix}58&64\\139&154\end{bmatrix}
Independent check

A separate finite-number calculation reproduced all four entries and confirmed the 2 by 2 output shape.

What this matrix multiplication covers

The product AB exists when the number of columns in A equals the number of rows in B. If A is m by n and B is n by p, then AB is m by p.

Check whether AB is defined

Compare columns of A with rows of B before multiplying, and preserve the requested dimensions when they do not match.

Examples: 2 by 3 times 3 by 4 is defined, 2 by 3 times 2 by 2 is undefined

Multiply rectangular matrices

Use independent dimensions for A and B, then form an output with rows of A and columns of B.

Examples: 2 by 3 times 3 by 2, 1 by 4 times 4 by 3

Inspect every dot product

See the row entries, column entries, products, and sum that produce each output cell.

Examples: c11, c12, c21, c22

Keep fractions exact

Multiply and add rational entries without rounding away the structure of the answer.

Examples: 1/2, -3/4, 1.25

Enter enough information for one clear task

  1. 1
    Choose the size of A

    Set rows and columns from one to four, then enter values in row order. Existing values stay in place when a dimension is changed.

  2. 2
    Choose the size of B

    For AB to exist, the row count of B must equal the column count of A. The compatibility message updates before calculation.

  3. 3
    Multiply matrices

    The result has one row for each row of A and one column for each column of B.

  4. 4
    Open the cell-level steps

    For each cij, follow row i of A across column j of B. The displayed sum explains the exact result entry.

Examples to try

Use these examples to recognize the method, compare equivalent forms, and check your own work.

Multiply two 2 by 2 matrices

Use each row of A against each column of B.

[2103][4522]\begin{bmatrix}2&-1\\0&3\end{bmatrix}\begin{bmatrix}4&5\\2&-2\end{bmatrix}

Expected result

[61266]\begin{bmatrix}6&12\\6&-6\end{bmatrix}

Rectangular product

The inner dimensions are both 3, so the result is 2 by 2.

[123456][789101112]\begin{bmatrix}1&2&3\\4&5&6\end{bmatrix}\begin{bmatrix}7&8\\9&10\\11&12\end{bmatrix}

Expected result

[5864139154]\begin{bmatrix}58&64\\139&154\end{bmatrix}

Row times column

One dot product produces a 1 by 1 result.

[214][352]\begin{bmatrix}2&-1&4\end{bmatrix}\begin{bmatrix}3\\5\\-2\end{bmatrix}

Expected result

[7]\begin{bmatrix}-7\end{bmatrix}

Multiply by the identity matrix

The identity columns select the original columns of A.

[3251][1001]\begin{bmatrix}3&-2\\5&1\end{bmatrix}\begin{bmatrix}1&0\\0&1\end{bmatrix}

Expected result

[3251]\begin{bmatrix}3&-2\\5&1\end{bmatrix}

Multiply by a zero matrix

Every dot product contains only zero contributions.

[1423][0000]\begin{bmatrix}1&-4\\2&3\end{bmatrix}\begin{bmatrix}0&0\\0&0\end{bmatrix}

Expected result

[0000]\begin{bmatrix}0&0\\0&0\end{bmatrix}

Multiply exact fractions

Keep each rational product exact before adding.

[12102][20112]\begin{bmatrix}\frac12&1\\0&2\end{bmatrix}\begin{bmatrix}2&0\\1&\frac12\end{bmatrix}

Expected result

[21221]\begin{bmatrix}2&\frac12\\2&1\end{bmatrix}

See why order matters

AB and BA use different row-column pairings.

A=[1101],B=[1011]A=\begin{bmatrix}1&1\\0&1\end{bmatrix},\quad B=\begin{bmatrix}1&0\\1&1\end{bmatrix}

Expected result

AB=[2111][1112]=BAAB=\begin{bmatrix}2&1\\1&1\end{bmatrix}\ne\begin{bmatrix}1&1\\1&2\end{bmatrix}=BA

Multiply a 2 by 3 matrix by a 3 by 2 matrix

The three columns of A match the three rows of B. The product will use the two outer dimensions, so AB is 2 by 2.

A=[123456],B=[789101112]A=\begin{bmatrix}1&2&3\\4&5&6\end{bmatrix},\qquad B=\begin{bmatrix}7&8\\9&10\\11&12\end{bmatrix}
  1. 1
    Calculate the first row of the product

    Use row 1 of A with columns 1 and 2 of B.

    c11=1(7)+2(9)+3(11)=58,c12=1(8)+2(10)+3(12)=64c_{11}=1(7)+2(9)+3(11)=58,\qquad c_{12}=1(8)+2(10)+3(12)=64
  2. 2
    Calculate the second row of the product

    Use row 2 of A with the same two columns of B.

    c21=4(7)+5(9)+6(11)=139,c22=4(8)+5(10)+6(12)=154c_{21}=4(7)+5(9)+6(11)=139,\qquad c_{22}=4(8)+5(10)+6(12)=154
  3. 3
    Place each value in its row and column

    The four dot products fill a 2 by 2 result matrix.

    AB=[5864139154]AB=\begin{bmatrix}58&64\\139&154\end{bmatrix}
AB=[5864139154]AB=\begin{bmatrix}58&64\\139&154\end{bmatrix}

Verification: Independent numerical loops reproduce 58, 64, 139, and 154, and the result has rows(A)=2 and columns(B)=2.

Common mistakes and how to fix them

Comparing the outer dimensions

Problem: Require rows of A to equal columns of B.

Why it matters: The dot products pair a row of A with a column of B, so their lengths come from columns of A and rows of B.

Better approach: Check columns(A)=rows(B). Use rows(A) by columns(B) for the output shape.

Multiplying corresponding entries

Problem: Multiply a11 by b11, a12 by b12, and stop.

Why it matters: That is an entrywise operation, not the row-by-column definition of matrix multiplication.

Better approach: For cij, multiply every entry in row i of A by the matching entry in column j of B, then add.

Assuming AB equals BA

Problem: Reverse the matrices without recalculating.

Why it matters: The dimensions may change or BA may be undefined, and even two defined products usually have different entries.

Better approach: Treat order as part of the problem and calculate the requested product only.

Predicting the wrong result size

Problem: Copy the dimensions of A or B automatically.

Why it matters: The shared inner dimension disappears into each dot product.

Better approach: Keep the two outer dimensions: rows of A by columns of B.

Checks, assumptions, and limits

How results are checked

  • Every entry is parsed by the site's Nerdamer mathematics library before multiplication.
  • Each result cell is built from an explicit row-by-column exact sum.
  • A separate finite-number implementation recomputes every product cell.
  • The result shape is checked against rows(A) by columns(B).

When to stop and revise the input

  • This release accepts finite real integers, decimals, and simple fractions, not variables or complex entries.
  • Each input matrix is limited to 4 by 4 so cell-level explanations remain usable.
  • The calculator evaluates AB only; chained products and powers require separate steps.
  • An incompatible product remains undefined and is never changed into entrywise multiplication.

Multiply matrices row by column FAQ

When can matrix A be multiplied by matrix B?

AB is defined when the number of columns in A equals the number of rows in B. Those are the inner dimensions used in every dot product.

What size is the product matrix?

If A is m by n and B is n by p, then AB is m by p. The result keeps the rows of A and the columns of B.

Why does the calculator show one step per result cell?

Each cij comes from a different row-column pairing. Showing the products and their sum makes it possible to locate a sign or arithmetic mistake instead of accepting an opaque result.

Does AB always equal BA?

No. Matrix multiplication is generally not commutative. BA can have different entries, a different shape, or be undefined even when AB exists.

Can matrix entries be fractions?

Yes. Enter simple fractions such as 1/2 or -3/4. The calculator keeps them exact through the row-by-column sums.

Sources and curriculum alignment

This page follows standard introductory mathematics notation and learning sequences. Use these references to continue with a complete course treatment.

Choose the resource that matches what you need to do next.

Created by Mathos AI. Methods, conditions, and checks are shown so you can review the mathematical reasoning.