Matrices can be added, subtracted, scaled by a number and multiplied together — but each operation comes with a rule about when it is even defined. Getting the "when" right is half the battle.
Addition and subtraction (conformability)
Two matrices can be added or subtracted only if they have the same order — we say they are conformable for addition. You then combine corresponding entries:
$$(A+B)_{ij}=a_{ij}+b_{ij},\qquad (A-B)_{ij}=a_{ij}-b_{ij}.$$
Addition inherits all the friendly properties of ordinary numbers: it is commutative ($A+B=B+A$), associative ($(A+B)+C=A+(B+C)$), has the zero matrix as additive identity ($A+O=A$), and every $A$ has an additive inverse $-A$ with $A+(-A)=O$.
Scalar multiplication
Multiplying a matrix by a scalar $k$ multiplies every entry by $k$: $(kA)_{ij}=k\,a_{ij}$. It distributes over both kinds of sum:
$$k(A+B)=kA+kB,\qquad (k+l)A=kA+lA,\qquad k(lA)=(kl)A.$$
Matrix multiplication
The product $AB$ is defined only when the number of columns of $A$ equals the number of rows of $B$. If $A$ is $m\times n$ and $B$ is $n\times p$, then $AB$ is $m\times p$ (the inner orders cancel, the outer orders survive):
$$(AB)_{ij}=\sum_{k=1}^{n} a_{ik}\,b_{kj}\quad(\text{row } i \text{ of } A \text{ paired with column } j \text{ of } B).$$
Operationally: to get the entry in row $i$, column $j$ of $AB$, slide along the $i$-th row of $A$ and down the $j$-th column of $B$, multiply matching terms and add. A handy memory aid: "$(m\times \boxed{n})(\boxed{n}\times p)=m\times p$" — the boxed inner numbers must agree.
Properties — and the famous failures
- NOT commutative: in general $AB\ne BA$. Indeed one product may be defined while the other is not, or they may have different orders, or merely differ in value.
- Associative: $A(BC)=(AB)C$ whenever the products are defined.
- Distributive: $A(B+C)=AB+AC$ and $(A+B)C=AC+BC$.
- Identity: $AI=IA=A$ for a conformable identity matrix.
- Zero divisors exist: $AB=O$ does not force $A=O$ or $B=O$. Two non-zero matrices can multiply to give the zero matrix.
Because of non-commutativity you must be careful with familiar algebra: in general $(A+B)^2=A^2+AB+BA+B^2\ne A^2+2AB+B^2$ (the cross terms only merge when $AB=BA$). The cancellation law fails too: $AB=AC$ does not allow you to cancel $A$ and conclude $B=C$.
Deeper Insight — multiplication is "rows meet columns", not entrywise. The single most common error is to multiply matrices entry-by-entry like addition. Matrix multiplication encodes composition — applying one transformation after another — which is exactly why order matters and why $AB\ne BA$. Putting on your socks then shoes is not the same as shoes then socks; matrices remember the order. Hold on to that picture and the non-commutativity stops being a surprise.
If $A=\begin{bmatrix}1&2\\3&4\end{bmatrix}$ and $B=\begin{bmatrix}2&0\\1&3\end{bmatrix}$, find $AB$.
Solution$AB=\begin{bmatrix}1\cdot2+2\cdot1 & 1\cdot0+2\cdot3\\ 3\cdot2+4\cdot1 & 3\cdot0+4\cdot3\end{bmatrix}=\begin{bmatrix}4 & 6\\ 10 & 12\end{bmatrix}.$
Answer: $AB=\begin{bmatrix}4 & 6\\ 10 & 12\end{bmatrix}$
For the same $A,B$, show $AB\ne BA$.
Solution$BA=\begin{bmatrix}2\cdot1+0\cdot3 & 2\cdot2+0\cdot4\\ 1\cdot1+3\cdot3 & 1\cdot2+3\cdot4\end{bmatrix}=\begin{bmatrix}2 & 4\\ 10 & 14\end{bmatrix}.$ Since $AB=\begin{bmatrix}4&6\\10&12\end{bmatrix}\ne BA$, multiplication is not commutative.
Answer: $BA=\begin{bmatrix}2 & 4\\ 10 & 14\end{bmatrix}\ne AB$, so multiplication is not commutative.
If $A=\begin{bmatrix}1&2\\2&4\end{bmatrix}$ and $B=\begin{bmatrix}2&-4\\-1&2\end{bmatrix}$, compute $AB$.
Solution$AB=\begin{bmatrix}1\cdot2+2\cdot(-1) & 1\cdot(-4)+2\cdot2\\ 2\cdot2+4\cdot(-1) & 2\cdot(-4)+4\cdot2\end{bmatrix}=\begin{bmatrix}0&0\\0&0\end{bmatrix}.$ A striking fact: $AB=O$ although neither $A$ nor $B$ is the zero matrix.
Answer: $AB=\begin{bmatrix}0&0\\0&0\end{bmatrix}=O$ even though neither $A$ nor $B$ is the zero matrix.
Find $2A-3B$ for $A=\begin{bmatrix}1&-1\\0&2\end{bmatrix}$, $B=\begin{bmatrix}0&1\\1&1\end{bmatrix}$.
Solution$2A=\begin{bmatrix}2&-2\\0&4\end{bmatrix}$, $3B=\begin{bmatrix}0&3\\3&3\end{bmatrix}$, so $2A-3B=\begin{bmatrix}2&-5\\-3&1\end{bmatrix}.$
Answer: $2A-3B=\begin{bmatrix}2&-5\\-3&1\end{bmatrix}$
Find the matrix $X$ such that $2X+3A=B$, where $A=\begin{bmatrix}1&2\\-1&0\end{bmatrix}$ and $B=\begin{bmatrix}5&4\\1&6\end{bmatrix}$.
SolutionSolve like ordinary algebra: $2X=B-3A$, so $X=\tfrac12(B-3A)$. Now $3A=\begin{bmatrix}3&6\\-3&0\end{bmatrix}$ and $B-3A=\begin{bmatrix}2&-2\\4&6\end{bmatrix}$. Hence $X=\begin{bmatrix}1&-1\\2&3\end{bmatrix}.$
Answer: $X=\begin{bmatrix}1&-1\\2&3\end{bmatrix}$
Multiply the conformable matrices $A=\begin{bmatrix}1&-1&2\\0&3&1\end{bmatrix}$ ($2\times3$) and $B=\begin{bmatrix}2&1\\0&1\\1&0\end{bmatrix}$ ($3\times2$).
SolutionColumns of $A$ ($3$) match rows of $B$ ($3$), so $AB$ is $2\times2$. Row $\times$ column: $AB=\begin{bmatrix}1\cdot2+(-1)\cdot0+2\cdot1 & 1\cdot1+(-1)\cdot1+2\cdot0\\ 0\cdot2+3\cdot0+1\cdot1 & 0\cdot1+3\cdot1+1\cdot0\end{bmatrix}=\begin{bmatrix}4&0\\1&3\end{bmatrix}.$
Answer: $AB=\begin{bmatrix}4&0\\1&3\end{bmatrix}$
If $A=\begin{bmatrix}3&1\\-1&2\end{bmatrix}$, find $A^2-5A+7I$ and hence verify the value of the expression.
Solution$A^2=\begin{bmatrix}3&1\\-1&2\end{bmatrix}\begin{bmatrix}3&1\\-1&2\end{bmatrix}=\begin{bmatrix}8&5\\-5&3\end{bmatrix}$. Then $5A=\begin{bmatrix}15&5\\-5&10\end{bmatrix}$ and $7I=\begin{bmatrix}7&0\\0&7\end{bmatrix}$. So $A^2-5A+7I=\begin{bmatrix}8-15+7 & 5-5+0\\ -5+5+0 & 3-10+7\end{bmatrix}=\begin{bmatrix}0&0\\0&0\end{bmatrix}=O.$ (This is the Cayley–Hamilton relation for $A$.)
Answer: $A^2-5A+7I=\begin{bmatrix}0&0\\0&0\end{bmatrix}=O$
Show that for $A=\begin{bmatrix}1&0\\0&-1\end{bmatrix}$ and $B=\begin{bmatrix}0&1\\1&0\end{bmatrix}$, $AB=-BA$ (the matrices anticommute).
Solution$AB=\begin{bmatrix}1&0\\0&-1\end{bmatrix}\begin{bmatrix}0&1\\1&0\end{bmatrix}=\begin{bmatrix}0&1\\-1&0\end{bmatrix}$, while $BA=\begin{bmatrix}0&1\\1&0\end{bmatrix}\begin{bmatrix}1&0\\0&-1\end{bmatrix}=\begin{bmatrix}0&-1\\1&0\end{bmatrix}$. Clearly $AB=-BA$, a vivid reminder that multiplication is not commutative.
Answer: $AB=-BA$ (the matrices anticommute).
If $A=\begin{bmatrix}2&3\\1&-1\end{bmatrix}$, $B=\begin{bmatrix}1&0\\2&1\end{bmatrix}$, $C=\begin{bmatrix}1&1\\0&2\end{bmatrix}$, verify the distributive law $A(B+C)=AB+AC$.
Solution$B+C=\begin{bmatrix}2&1\\2&3\end{bmatrix}$, so $A(B+C)=\begin{bmatrix}2&3\\1&-1\end{bmatrix}\begin{bmatrix}2&1\\2&3\end{bmatrix}=\begin{bmatrix}10&11\\0&-2\end{bmatrix}$. Separately $AB=\begin{bmatrix}8&3\\-1&-1\end{bmatrix}$ and $AC=\begin{bmatrix}2&8\\1&-1\end{bmatrix}$, whose sum is $\begin{bmatrix}10&11\\0&-2\end{bmatrix}$. The two sides agree, confirming distributivity.
Answer: Both sides equal $\begin{bmatrix}10&11\\0&-2\end{bmatrix}$, confirming $A(B+C)=AB+AC$.
A shop sells $3$ pens and $2$ notebooks; pens cost ₹5 and notebooks ₹40 each. Express the total bill as a matrix product.
SolutionWrite quantities as a row matrix and prices as a column matrix (conformable $1\times2$ times $2\times1$): $\begin{bmatrix}3 & 2\end{bmatrix}\begin{bmatrix}5\\ 40\end{bmatrix}=\begin{bmatrix}3\cdot5+2\cdot40\end{bmatrix}=\begin{bmatrix}95\end{bmatrix}$. The bill is ₹95 — this "quantity row $\times$ price column" pattern is how matrices model real cost tables.
Answer: The bill is ₹95, obtained as $\begin{bmatrix}3 & 2\end{bmatrix}\begin{bmatrix}5\\ 40\end{bmatrix}=\begin{bmatrix}95\end{bmatrix}$.
If $A=\begin{bmatrix}0&1\\0&0\end{bmatrix}$, compute $A^2$. What does this say about powers of a matrix?
Solution$A^2=\begin{bmatrix}0&1\\0&0\end{bmatrix}\begin{bmatrix}0&1\\0&0\end{bmatrix}=\begin{bmatrix}0&0\\0&0\end{bmatrix}=O.$ So a non-zero matrix can have $A^2=O$ (it is called nilpotent); the rule "$x^2=0\Rightarrow x=0$" from numbers fails for matrices.
Answer: $A^2=\begin{bmatrix}0&0\\0&0\end{bmatrix}=O$, so a non-zero matrix can be nilpotent.