Matrix Operations: Addition, Multiplication and Properties
Solver AI TeamPublished Updated 12 min read
Master matrix operations with this complete guide. Learn how to add, subtract, and multiply matrices, understand their key properties, and see how identity matrices and transposes work with fully worked examples.
Frequently asked questions
When can you multiply two matrices?
You can multiply A by B only when the number of columns in A equals the number of rows in B. An m × n matrix times an n × p matrix gives an m × p matrix. If the inner sizes differ, the product is undefined.
How do you multiply two matrices step by step?
Each entry of the product is a row of A dotted with a column of B: multiply matching entries and add them. The entry in row i, column j uses row i of A and column j of B. Repeat for every position in the result.
Is matrix multiplication commutative?
No. In general AB ≠ BA, and sometimes only one of the two products even exists. It is associative, (AB)C = A(BC), and distributive over addition, but you must keep the order of the factors.
What is the identity matrix and what does it do?
The identity matrix I has 1s on the main diagonal and 0s elsewhere. Multiplying by it leaves a matrix unchanged: AI = IA = A, as long as the sizes fit. It plays the role that the number 1 plays in ordinary multiplication.
How do you find the transpose of a matrix?
Swap rows and columns, so the entry in row i, column j moves to row j, column i. A 2 × 3 matrix becomes a 3 × 2 matrix. A useful rule is (AB)ᵀ = BᵀAᵀ, which reverses the order.
Matrix operations combine rectangular arrays of numbers. Add or subtract matrices of the same size entry by entry, multiply by a scalar by scaling every entry, and multiply two matrices by taking row-by-column dot products, which works only when the first matrix has as many columns as the second has rows. Matrix multiplication is not commutative, so AB and BA usually differ.
Matrix Addition and Subtraction
A matrix is a rectangular array of numbers arranged in rows and columns, and matrix addition is the simplest operation you can perform on them. To add two matrices, they must have the exact same dimensions — the same number of rows and the same number of columns.
The Rule — Matrix Addition
If A and B are both m × n matrices, then A + B is also an m × n matrix, formed by adding corresponding entries. In symbols, (A + B)ᵢⱼ = Aᵢⱼ + Bᵢⱼ.
Example — Addition and Subtraction of 2×2 Matrices
If A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]], then A + B = [[1+5, 2+6], [3+7, 4+8]] = [[6, 8], [10, 12]].
Subtraction works exactly the same way — just subtract corresponding entries: A − B = [[1−5, 2−6], [3−7, 4−8]] = [[−4, −4], [−4, −4]].
AnswerA + B = [[6, 8], [10, 12]]
Common Mistake
If the dimensions don't match, the operation is undefined. You cannot add a 2 × 3 matrix to a 3 × 2 matrix, and you cannot subtract a row vector from a column vector.
The Takeaway
Matrix addition is commutative (A + B = B + A) and associative ((A + B) + C = A + (B + C)), just like ordinary numerical addition. It is also the foundation for every other matrix operation — understanding it well makes the more complex operations much easier to grasp.
Scalar Multiplication
Definition — Scalar Multiplication
Scalar multiplication means multiplying every entry of a matrix by a single number (called a scalar). If A is a matrix and c is a scalar, then cA is the matrix obtained by multiplying each entry of A by c. In symbols, (cA)ᵢⱼ = c · Aᵢⱼ.
Example — Scaling a 2×2 Matrix
If A = [[2, −1], [0, 4]] and c = 3, then 3A = [[6, −3], [0, 12]].
If c = −1, you get the negative of the matrix: −A = [[−2, 1], [0, −4]].
Answer3A = [[6, −3], [0, 12]]
Algebraic properties
Corollary — Distribution and Associativity
Scalar multiplication distributes over matrix addition: c(A + B) = cA + cB. It also distributes over scalar addition: (c + d)A = cA + dA. And it is associative with scalar multiplication: c(dA) = (cd)A. These properties should feel familiar because they mirror the rules of ordinary algebra.
The Key Insight
Why it matters: Scalar multiplication is essential in linear algebra because it lets you rescale vectors, normalize data, and combine matrices linearly. In computer graphics, scaling an object uses a scalar-like multiplication on its coordinate matrix. In statistics, standardizing data involves scaling each entry. In physics, doubling a force vector is scalar multiplication. It is the simplest kind of transformation you can apply to a matrix and is used inside almost every larger operation.
Matrix Multiplication Step by Step
Matrix multiplication is the most important — and most commonly misunderstood — operation in linear algebra.
The Rule — Matrix Multiplication
To multiply A · B, the number of columns in A must equal the number of rows in B. If A is m × n and B is n × p, the product AB is an m × p matrix. The entry in row i, column j of AB is found by taking the dot product of the i-th row of A with the j-th column of B: (AB)ᵢⱼ = Σₖ Aᵢₖ · Bₖⱼ.
Example 1 — 2×2 by 2×2 Product
Let A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]]. Both are 2 × 2, so the product exists and is 2 × 2.
Entry (1,1): row 1 of A · col 1 of B = 1·5 + 2·7 = 19.
Entry (1,2): 1·6 + 2·8 = 22.
Entry (2,1): 3·5 + 4·7 = 43.
Entry (2,2): 3·6 + 4·8 = 50.
AnswerAB = [[19, 22], [43, 50]]
Example 2 — Non-square dimensions
Non-square example: If A is 2 × 3 and B is 3 × 1, then AB is 2 × 1.
AnswerAB is 2 × 1
Common Mistake
Always write down the dimensions before multiplying — it prevents half of all mistakes. If the inner dimensions don't match, the product is undefined, and you have to stop immediately.
Properties (Associative, Distributive, Not Commutative)
Matrix multiplication shares some properties with ordinary multiplication but breaks a very important one.
The Rule — Associative and Distributive Laws
Associative:(AB)C = A(BC), provided all the products are defined. This means you can group matrices any way you like when chaining them. Distributive over addition:A(B + C) = AB + AC and (A + B)C = AC + BC. These distributive laws let you expand and factor matrix expressions similar to numerical algebra.
The Key Insight
Not commutative: In general, AB ≠ BA. This is the biggest difference between matrix multiplication and regular multiplication.
Example — AB versus BA
With A = [[1, 2], [3, 4]] and B = [[0, 1], [1, 0]], AB = [[2, 1], [4, 3]] but BA = [[3, 4], [1, 2]]. The two products are completely different.
In fact, for non-square matrices, BA may not even be defined when AB is.
AnswerAB ≠ BA
Common Mistake — Cancellation
Because of this, you must be extremely careful about the order in which you multiply matrices — the order changes the result. You cannot "cancel" matrices the same way you cancel numbers: if AB = AC, it does not follow that B = C.
Common Mistake — Squaring a Product
You also cannot assume (AB)² = A²B² — that expansion is only valid when A and B commute, which is rare. These non-commutative quirks are the main reason linear algebra requires careful bookkeeping.
Identity and Zero Matrices
Definition — Identity Matrix
The identity matrix, denoted I (or Iₙ for an n × n identity), is the matrix with 1s on the main diagonal and 0s everywhere else. For example, I₂ = [[1, 0], [0, 1]] and I₃ = [[1, 0, 0], [0, 1, 0], [0, 0, 1]].
The Key Insight
The identity matrix plays the same role in matrix multiplication that the number 1 plays in ordinary multiplication: multiplying any matrix by the identity leaves it unchanged. That is, AI = IA = A, as long as the dimensions are compatible.
Example — Multiplying by the Identity
If A = [[2, 3], [4, 5]], then AI₂ = A and I₂A = A.
AnswerAI₂ = I₂A = A
The inverse matrix
Corollary — Inverse Matrix
The identity matrix is essential for defining the inverse of a matrix: if AB = BA = I, then B is called the inverse of A, written A⁻¹. Only square matrices can have inverses, and not every square matrix does.
The zero matrix
Definition — Zero Matrix
The zero matrix, denoted 0, is a matrix in which every entry is zero. It plays the same role as the number 0 in ordinary arithmetic: A + 0 = A and A · 0 = 0.
Common Mistake
However, unlike numerical arithmetic, AB = 0 does not imply that A = 0 or B = 0. Two non-zero matrices can multiply to give the zero matrix — another subtle quirk of matrix algebra that trips up beginners.
Transpose and Its Properties
Definition — Transpose
The transpose of a matrix A, written Aᵀ, is the matrix obtained by switching rows and columns. If A is m × n, then Aᵀ is n × m, with (Aᵀ)ᵢⱼ = Aⱼᵢ.
Example — Transposing a 2×3 Matrix
If A = [[1, 2, 3], [4, 5, 6]], then Aᵀ = [[1, 4], [2, 5], [3, 6]]. The first row of A becomes the first column of Aᵀ, the second row becomes the second column, and so on.
AnswerAᵀ = [[1, 4], [2, 5], [3, 6]]
Key properties
#
Property
Statement
Why
1
Double transpose
(Aᵀ)ᵀ = A
Transposing twice returns the original matrix.
2
Sum
(A + B)ᵀ = Aᵀ + Bᵀ
The transpose of a sum is the sum of the transposes.
3
Scalar
(cA)ᵀ = cAᵀ
Scalar multiplication commutes with transposition.
4
Reverse-order law
(AB)ᵀ = BᵀAᵀ
The order is reversed so dimensions match correctly after the transpose.
Common Mistake — Reverse-order law
Notice that the order is reversed — this often surprises students. The reason is that to match dimensions correctly after the transpose, the factors must be flipped.
Symmetric matrices
Corollary — Symmetric Matrices
A matrix is called symmetric if Aᵀ = A, which requires A to be square and mirror-image across its main diagonal. Symmetric matrices play a central role in statistics (covariance matrices), optimization (Hessians), and graph theory (adjacency matrices of undirected graphs).
The Takeaway
If you want to practice any of these operations or check your work on a matrix problem, scan it with Solver AI for a step-by-step walkthrough.