# Dimensions of a Matrix

The dimensions of a matrix are the number of rows by the number of columns.  If a matrix has $a$ rows and $b$ columns, it is an $a×b$ matrix.  For example, the first matrix shown below is a $2×2$ matrix; the second one is a $1×4$ matrix; and the third one is a $3×3$ matrix.

$\left[\begin{array}{rr}\hfill 3& \hfill 5\\ \hfill 99& \hfill -0.5\end{array}\right]$

$\left[\begin{array}{rrrr}\hfill \frac{1}{3}& \hfill 7& \hfill \frac{2}{3}& \hfill 6\end{array}\right]$

$\left[\begin{array}{rrr}\hfill x& \hfill 0& \hfill 0\\ \hfill 0& \hfill 4x& \hfill 0\\ \hfill 0& \hfill 0& \hfill y\end{array}\right]$

When you add and subtract matrices , their dimensions must be the same; when you multiply them, their dimensions must be compatible .