Skip to content

Matrices Basics Explained: Notation, Addition, Multiplication and Transpose

By Sprout Calculator Editorial Team Bylines · Published November 5, 2026 · Updated November 6, 2026

A matrix is a rectangular grid of numbers in rows and columns. Add or subtract matrices of the same size entry by entry. To multiply, each result entry is the dot product of a row from the first matrix and a column from the second, so the first must have as many columns as the second has rows.

What is a matrix?

A matrix is a rectangular array of numbers arranged in rows and columns. We write it inside brackets. The size, or dimension, is given as rows × columns. This matrix is 2 × 3, meaning 2 rows and 3 columns:

A=(14−2035)A = \begin{pmatrix} 1 & 4 & -2 \\ 0 & 3 & 5 \end{pmatrix}

Each number is an entry or element. The entry in row i and column j is written aᵢⱼ. In A above, a₁₂ = 4 (row 1, column 2) and a₂₃ = 5.

Matrices store tables of data, describe systems of equations, represent transformations like rotations and scaling, and sit behind computer graphics and machine learning. The matrix calculator does the arithmetic below for matrices of different sizes.

What are the common types of matrices?

  • Square matrix: the same number of rows and columns, such as 3 × 3.
  • Row matrix: one row, such as (2 5 7).
  • Column matrix: one column. Also called a vector.
  • Zero matrix: every entry is 0.
  • Diagonal matrix: nonzero entries only on the main diagonal, which runs from top left to bottom right.
  • Identity matrix (I): a diagonal matrix with 1s on the diagonal.
  • Symmetric matrix: equal to its transpose, so aᵢⱼ = aⱼᵢ.

The 3 × 3 identity matrix is:

I=(100010001)I = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}

How do you add and subtract matrices?

Add or subtract matching entries. Both matrices must have the same size.

(1234)+(50−12)=(6226)\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} + \begin{pmatrix} 5 & 0 \\ -1 & 2 \end{pmatrix} = \begin{pmatrix} 6 & 2 \\ 2 & 6 \end{pmatrix}

Subtraction works the same way: subtract each pair of matching entries. A 2 × 2 and a 2 × 3 matrix cannot be added, because some entries have no partner.

Addition is commutative (A + B = B + A) and associative, like ordinary addition.

How does scalar multiplication work?

Multiply every entry by the number. A scalar is just an ordinary number.

3(2−104)=(6−3012)3 \begin{pmatrix} 2 & -1 \\ 0 & 4 \end{pmatrix} = \begin{pmatrix} 6 & -3 \\ 0 & 12 \end{pmatrix}

If you multiply by −1, every sign flips. Scalar multiplication lets you write subtraction as A − B = A + (−1)B.

How do you multiply two matrices?

Each entry of the product is the dot product of a row of the first matrix and a column of the second: multiply matching entries and add.

For an m × n matrix A and an n × p matrix B, the product AB is m × p. The inner dimensions (n and n) must match, and they disappear. The outer dimensions give the size of the result.

Example.

(1234)(5678)\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix}
  • Row 1 · column 1: 1·5 + 2·7 = 19.
  • Row 1 · column 2: 1·6 + 2·8 = 22.
  • Row 2 · column 1: 3·5 + 4·7 = 43.
  • Row 2 · column 2: 3·6 + 4·8 = 50.

The product is

(19224350)\begin{pmatrix} 19 & 22 \\ 43 & 50 \end{pmatrix}

Example with different sizes. A 2 × 3 times a 3 × 1 gives a 2 × 1:

(102311)(241)=(1⋅2+0⋅4+2⋅13⋅2+1⋅4+1⋅1)=(411)\begin{pmatrix} 1 & 0 & 2 \\ 3 & 1 & 1 \end{pmatrix} \begin{pmatrix} 2 \\ 4 \\ 1 \end{pmatrix} = \begin{pmatrix} 1\cdot2 + 0\cdot4 + 2\cdot1 \\ 3\cdot2 + 1\cdot4 + 1\cdot1 \end{pmatrix} = \begin{pmatrix} 4 \\ 11 \end{pmatrix}

A helpful way to remember: go across the row, down the column.

Is matrix multiplication commutative?

No. For the matrices above, BA is

(5678)(1234)=(23343146)\begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix} \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} = \begin{pmatrix} 23 & 34 \\ 31 & 46 \end{pmatrix}

which is not the same as AB. Sometimes only one of the products exists. A 2 × 3 times a 3 × 2 is defined and is 2 × 2, while the reverse order is 3 × 2 times 2 × 3, which is 3 × 3.

Matrix multiplication is still associative, (AB)C = A(BC), and it distributes: A(B + C) = AB + AC. You just cannot swap the order of factors.

What does the identity matrix do?

Multiplying by the identity leaves a matrix unchanged: AI = IA = A when the sizes fit. It is the matrix version of the number 1.

(2513)(1001)=(2513)\begin{pmatrix} 2 & 5 \\ 1 & 3 \end{pmatrix} \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} = \begin{pmatrix} 2 & 5 \\ 1 & 3 \end{pmatrix}

The identity is also what you aim for in an inverse: a matrix times its inverse equals I. Our guide to determinants and inverses shows how.

What is the transpose?

The transpose of a matrix, written Aᵀ, flips it over its main diagonal. Rows become columns and columns become rows.

A=(123456),AT=(142536)A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix}, \qquad A^T = \begin{pmatrix} 1 & 4 \\ 2 & 5 \\ 3 & 6 \end{pmatrix}

A 2 × 3 becomes a 3 × 2. Useful rules: (Aᵀ)ᵀ = A, (A + B)ᵀ = Aᵀ + Bᵀ, and (AB)ᵀ = BᵀAᵀ. Notice the order reverses for a product.

How are matrices used?

  • Solving systems of equations. A system like 2x + y = 5, x − y = 1 can be written as AX = B.
  • Computer graphics. Rotations, scaling and translations of points are done by multiplying coordinate vectors by matrices.
  • Data and statistics. A spreadsheet of numbers is a matrix. Regression and covariance use matrix algebra.
  • Networks. An adjacency matrix records which nodes connect.
  • Economics and population models. Transition matrices describe how a system moves from one state to the next.

Example. A bakery sells muffins and cookies. Matrix P holds prices, and matrix Q holds quantities sold per day. Multiplying them gives daily revenue, and adding matrices from different days gives weekly totals.

What mistakes should you avoid?

  • Adding matrices of different sizes.
  • Multiplying entry by entry. That is not matrix multiplication. Use row-by-column dot products.
  • Assuming AB = BA.
  • Mismatched inner dimensions when multiplying. Check the sizes first.
  • Forgetting to reverse the order in (AB)ᵀ = BᵀAᵀ.
  • Misplacing the entries when transposing. Row 1 becomes column 1.
  • Arithmetic slips. Keep a clear layout and check with the matrix calculator.

To practice, take two 2 × 2 matrices and compute A + B, 2A, AB and BA by hand. Then try a 2 × 3 and a 3 × 2. Verify each result, and write down the size of every answer before you start computing. That habit catches most errors early.

How do matrices transform points?

A 2×2 matrix can move points in the plane. Writing a point (x, y) as a column, multiplying by the matrix gives a new point. The matrix (2 0; 0 2) doubles both coordinates, which scales a shape to twice the size. The matrix (0 −1; 1 0) rotates a point 90° counterclockwise: (3, 1) becomes (−1, 3). The matrix (1 0; 0 −1) reflects points across the x-axis.

Applying two transformations in a row corresponds to multiplying their matrices, and the order matters, because rotating then scaling can differ from scaling then rotating when the scaling is not uniform. This is one concrete reason that matrix multiplication is not commutative, and it is the basis of animation and game graphics.

FAQ

Frequently asked questions

01How do I know if two matrices can be multiplied?

The number of columns in the first matrix must equal the number of rows in the second. A 2 by 3 matrix can multiply a 3 by 4 matrix, giving a 2 by 4 result. A 2 by 3 matrix cannot multiply another 2 by 3 matrix.

02Is matrix multiplication commutative?

No. In general AB and BA are different, and one product may exist while the other does not. Matrix multiplication is associative, so (AB)C equals A(BC), and it distributes over addition, but you must keep the order of the factors.

03What is the identity matrix?

The identity matrix is a square matrix with 1s on the main diagonal and 0s everywhere else. It acts like the number 1 in multiplication: multiplying any matrix by the identity of the right size returns the original matrix unchanged.

04What happens when you multiply a matrix by a zero matrix?

You get a zero matrix of the matching size. Every entry of the product is a sum of terms that each include a zero, so every entry is 0. This is the matrix version of multiplying a number by 0.