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.
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ᵢⱼ.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]].
A + B = [[6, 8], [10, 12]]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.
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
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ᵢⱼ.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]].
3A = [[6, −3], [0, 12]]Algebraic properties
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.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.
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ₖⱼ.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.
AB = [[19, 22], [43, 50]]Non-square example: If A is 2 × 3 and B is 3 × 1, then AB is 2 × 1.
AB is 2 × 1Always 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.
(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.Not commutative: In general, AB ≠ BA. This is the biggest difference between matrix multiplication and regular multiplication.
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.
AB ≠ BABecause 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.
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
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 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.
If A = [[2, 3], [4, 5]], then AI₂ = A and I₂A = A.
AI₂ = I₂A = AThe inverse matrix
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
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.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
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ⱼᵢ.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.
Aᵀ = [[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. |
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
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).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.