Definition of equality of matrices
Definition: Two matrices $A$ and $B$ are equal, written $A = B$, if and only if:
- They have the same size ($m \times n$), and
- Corresponding entries are equal: $a_{ij} = b_{ij}$ for all $i$ and $j$.
Formally, $A = B \iff a_{ij} = b_{ij} \quad \forall\, 1 \leq i \leq m, \; 1 \leq j \leq n$.
Example:
$$\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}$$
but
$$\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} \neq \begin{pmatrix} 1 & 2 \\ 3 & 5 \end{pmatrix}$$
Note: matrices of different sizes can never be equal.