Mathwords logoMathwords

Dimensions of a Matrix — Definition, Examples & Formula

Dimensions of a Matrix

The number of rows and columns of a matrix, written in the form rows×columns. The matrix below has 2 rows and 3 columns, so its dimensions are 2×3. This is read aloud, "two by three."

Note: One way to remember that Rows come first and Columns come second is by thinking of RC Cola®.

 

2×3 matrix with rows [2, 0, -5] and [-1, 3, 6], illustrating 2 rows and 3 columns.

 

 

See also

Square matrix

Key Formula

Dimensions=m×n\text{Dimensions} = m \times n
Where:
  • mm = The number of rows (horizontal lines of entries) in the matrix
  • nn = The number of columns (vertical lines of entries) in the matrix

Worked Example

Problem: Find the dimensions of the following matrix: A=[583127649035]A = \begin{bmatrix} 5 & 8 & 3 & 1 \\ 2 & 7 & 6 & 4 \\ 9 & 0 & 3 & 5 \end{bmatrix}
Step 1: Count the number of rows. Rows run horizontally across the matrix. This matrix has 3 rows.
m=3m = 3
Step 2: Count the number of columns. Columns run vertically down the matrix. This matrix has 4 columns.
n=4n = 4
Step 3: Write the dimensions as rows × columns.
Dimensions of A=3×4\text{Dimensions of } A = 3 \times 4
Answer: Matrix A is a 3 × 4 matrix (read "three by four"). It contains 3 × 4 = 12 entries in total.

Another Example

This example covers edge cases where one dimension equals 1, producing row vectors and column vectors. It shows that even single-row or single-column arrays are still matrices with well-defined dimensions.

Problem: Two matrices are given: B=[2741]B = \begin{bmatrix} 2 \\ 7 \\ 4 \\ 1 \end{bmatrix} and C=[358]C = \begin{bmatrix} 3 & 5 & 8 \end{bmatrix}. Find the dimensions of each.
Step 1: For matrix B, count the rows. There are 4 entries stacked vertically, so there are 4 rows.
mB=4m_B = 4
Step 2: Count the columns in B. Each row has only 1 entry, so there is 1 column. A matrix with a single column is called a column vector.
nB=1B is 4×1n_B = 1 \quad \Rightarrow \quad B \text{ is } 4 \times 1
Step 3: For matrix C, count the rows. There is only 1 row of entries. A matrix with a single row is called a row vector.
mC=1m_C = 1
Step 4: Count the columns in C. There are 3 entries in that row.
nC=3C is 1×3n_C = 3 \quad \Rightarrow \quad C \text{ is } 1 \times 3
Answer: Matrix B is 4 × 1 (a column vector) and matrix C is 1 × 3 (a row vector).

Frequently Asked Questions

Do rows or columns come first when writing the dimensions of a matrix?
Rows always come first, then columns. A handy mnemonic is "RC" — like RC Cola® — where R (rows) comes before C (columns). So a matrix with 5 rows and 2 columns is written as 5 × 2, never 2 × 5.
What is the difference between a 2 × 3 matrix and a 3 × 2 matrix?
A 2 × 3 matrix has 2 rows and 3 columns, while a 3 × 2 matrix has 3 rows and 2 columns. Even though both contain 6 entries, they are different shapes and are generally not interchangeable. You cannot add a 2 × 3 matrix to a 3 × 2 matrix because their dimensions do not match.
Why do matrix dimensions matter for multiplication?
To multiply matrix A (dimensions m × n) by matrix B (dimensions p × q), the inner dimensions must match: n must equal p. The resulting product matrix has dimensions m × q. If the inner dimensions don't match, the multiplication is undefined.

Dimensions of a Matrix vs. Order (or Size) of a Matrix

Dimensions of a MatrixOrder (or Size) of a Matrix
DefinitionThe number of rows by the number of columns, written as m × nMeans exactly the same thing — "order" and "dimensions" are synonyms for matrices
NotationTypically written as m × n (e.g., 3 × 4)Also written as m × n or sometimes m-by-n
When usedCommon in algebra and introductory coursesCommon in linear algebra and more formal contexts
Square caseWhen m = n, you say "n × n" or "dimensions are n × n"When m = n, you may simply say "a matrix of order n"

Why It Matters

You need to know a matrix's dimensions before you can perform any operation on it. Matrix addition requires both matrices to have identical dimensions, and matrix multiplication requires the number of columns in the first matrix to equal the number of rows in the second. Dimensions appear constantly in algebra, statistics, computer science, and data analysis whenever information is organized into tables or grids.

Common Mistakes

Mistake: Writing columns × rows instead of rows × columns
Correction: Rows always come first. Remember the mnemonic "RC" (like RC Cola): Rows before Columns. A matrix with 2 rows and 5 columns is 2 × 5, not 5 × 2.
Mistake: Confusing the total number of entries with the dimensions
Correction: A matrix with 12 entries could be 3 × 4, 4 × 3, 2 × 6, 6 × 2, 1 × 12, or 12 × 1. Dimensions specify the shape, not just the total count. Always state both the row count and the column count.

Related Terms