Matrix Multiplication Calculator

Quick answer

A matrix multiplication calculator multiplies two square matrices using the row-by-column rule, where each entry is a row of the first matrix dotted with a column of the second. Enter both matrices row by row. Two 2x2 matrices give a 2x2 product.

Updated 2026-09-09By Shakeel MuzaffarReviewed by Prof. Dr. Khalil Mudassar, PhD
Try
Linear Algebra
Both matrices are square and the same size.
All entries of the first matrix, left to right and top to bottom.
All entries of the second matrix, in the same order.
Product A x B
--
Size--
Trace (diagonal sum)--

Calculations run in your browser. Inputs are not sent to our servers; anything you Save stays in this browser only.

Saved results (0)

How to Use the Matrix Multiplication Calculator

  1. Choose the matrix size, 2 by 2 or 3 by 3.
  2. Enter Matrix A row by row, separated by commas.
  3. Enter Matrix B the same way.
  4. Read the product, shown row by row, and its trace.

Here is what each result means:

ResultWhat it means
Product A x BThe result matrix, written row by row.
SizeThe dimensions of the product.
TraceThe sum of the diagonal entries.

What Is Matrix Multiplication?

Matrix multiplication combines two matrices into a new one using the row-by-column rule. Each entry of the product is a row of the first matrix multiplied term by term with a column of the second, and those products added. So the entry in row i, column j comes from row i of A and column j of B.

Matrix multiplication is how linear transformations combine, so it powers computer graphics, rotations, systems of equations and machine learning. Unlike ordinary multiplication, it is not commutative: A times B is usually different from B times A, and the order matters.

How Does the Matrix Calculator Work?

It computes each entry of the product as the dot product of a row and a column.

Rule: (A B)[i][j] = sum over k of A[i][k] x B[k][j]
  1. Take a row of A and a column of B.
  2. Multiply matching entries and add them for one product entry.
  3. Repeat for every row and column to fill the product matrix.

The determinant of the product equals the product of the determinants, which you can check with the determinant calculator.

Matrix Multiplication Example

Multiply the 2x2 matrices A with rows 1, 2 and 3, 4, and B with rows 5, 6 and 7, 8.

Calculation: the top-left entry is the first row of A dotted with the first column of B: 1 x 5 + 2 x 7 = 19. Continuing gives the product [19, 22 ; 43, 50]. The trace, 19 plus 50, is 69.

The Row-by-Column Rule

Each entry pairs one row of A with one column of B.

Product entryComes from
Row 1, column 1Row 1 of A and column 1 of B
Row 1, column 2Row 1 of A and column 2 of B
Row 2, column 1Row 2 of A and column 1 of B

For two matrices to multiply, the columns of the first must match the rows of the second. Here both are square and the same size, so they always fit.

Matrix Multiplication vs Addition

The two operations combine matrices in very different ways.

OperationHow it worksOrder matters?
AdditionAdd matching entriesNo
MultiplicationRow-by-column dot productsYes

Addition needs matrices of the same shape and is commutative. Multiplication combines rows and columns and is not, so A times B and B times A can differ.

What Affects the Product

The Order of the Matrices

Multiplication is not commutative, so swapping A and B usually changes the result.

The Identity Matrix

Multiplying by the identity, ones on the diagonal, leaves a matrix unchanged.

A Zero Row or Column

Zeros in A or B carry through, producing zero entries in the product.

When to Use a Matrix Multiplication Calculator

Linear Algebra Homework

Multiply matrices quickly and check each entry.

Transformations

Combine rotations, scalings or reflections by multiplying their matrices.

Systems and Models

Apply a matrix to data, as in graphics and machine learning.

Common Mistakes

1. Multiplying Entry by Entry

Matrix multiplication is not element-wise. Each entry is a row dotted with a column.

2. Assuming a B Equals B A

Order matters. The two products are usually different matrices.

3. Mismatched Sizes

The columns of the first must equal the rows of the second. Here both are the same square size.

4. Losing Track of Rows and Columns

Enter each matrix row by row, left to right, so the entries land in the right places.

5. Skipping a Term in the Sum

Each product entry adds one term per dimension. Missing one gives a wrong number.

Accuracy and Limitations

The multiplication is exact; only the displayed decimals are rounded.

What it calculates accurately

  • The full product of two square matrices
  • The trace of the result
  • 2x2 and 3x3 sizes

What it does not do

  • Multiply non-square or mismatched matrices
  • Find an inverse or determinant directly
  • Handle matrices larger than 3x3
  • Work with complex entries

How We Multiply Your Matrices

Method
Each product entry is a row of A dotted with a column of B, summed over the shared dimension.
Inputs used
The size and both matrices, row by row.
Assumptions
Two square matrices of the same size, 2x2 or 3x3.
Rounding
Each entry and the trace to five decimals.
Edge cases
The identity leaves a matrix unchanged; order changes the product.
Sources
See Sources below.
Last reviewed
2026-09-08.

Frequently Asked Questions

How do you multiply two matrices?

Use the row-by-column rule: each entry of the product is a row of the first matrix multiplied term by term with a column of the second, and the products added. This tool does that for every entry.

Is matrix multiplication commutative?

No. In general A times B is not the same as B times A, and often only one order is even defined. The order of the matrices matters.

What sizes can be multiplied?

The number of columns in the first matrix must equal the number of rows in the second. This tool handles two square matrices of the same size, 2x2 or 3x3, so they always fit.

What is the identity matrix?

It is a square matrix with ones on the diagonal and zeros elsewhere. Multiplying any matrix by the identity leaves it unchanged, like multiplying a number by 1.

What is the trace of a matrix?

The trace is the sum of the diagonal entries, from the top left to the bottom right. It is a quick summary value and appears in many linear-algebra results.

How is matrix multiplication used?

It combines linear transformations, so it drives computer graphics, rotations and scaling, solving systems of equations, and the layers of a neural network.

Why is the product not element-wise?

Element-wise multiplication is a different operation. Matrix multiplication mixes rows and columns so that it represents composing two transformations, which element-wise multiplication does not.

What does multiplying by a zero matrix give?

A matrix of all zeros. Every product entry sums terms that each include a zero, so the whole product is zero.

Is my information saved?

No. The calculation runs in your browser and nothing you enter is stored or sent anywhere, unless you choose Save, which keeps the result only on this device.

Sources

Related Calculators

Looking for more algebra tools?

Explore all math calculators

This calculator multiplies two square matrices of the same size, 2x2 or 3x3. Enter each matrix row by row. Matrix multiplication is not commutative, so A times B usually differs from B times A. Results are rounded for display. Spotted an error? Let us know.

Author

shakeel-Muzaffar
Founder & Editor-in-Chief at  ~ Web ~  More Posts

Shakeel Muzaffar is the Founder and Editor-in-Chief of MultiCalculators.com, bringing over 15 years of experience in digital publishing, product strategy, and online tool development. He leads the platform's editorial vision, ensuring every calculator meets strict standards for accuracy, usability, and real-world value. Shakeel personally oversees content quality, formula verification workflows, and the platform's commitment to publishing tools that are genuinely useful for students, professionals, and everyday users worldwide.