Tutorials › Linear Algebra › Matrix Dimensions, Entries, And Equality

Matrix Operations and Algebra · Tutorial 56 of 1000

Matrix Dimensions, Entries, And Equality

Read matrix sizes and entries accurately, and use dimensions and corresponding positions to test matrix equality.

Beginner 8 min read

What You'll Learn

  • Identify the numbers of rows and columns in a matrix.
  • Interpret the indices in an entry such as a_ij.
  • Write the dimension of a matrix using m by n notation.
  • Decide whether matrices of different dimensions can be equal.
  • Check equality by comparing every corresponding entry.
  • Distinguish matching entries in the same positions from matching collections of values.

Reading a Matrix as a Rectangular Array

A matrix is not only a collection of values: it is a rectangular array in which every value has a specified position. The number of rows and the number of columns describe the array’s shape. The position of an entry matters just as much as its value, so reading the dimensions and indices correctly is essential before comparing matrices or working with them.

Unless stated otherwise, take matrix entries to be real numbers. If a matrix has \(m\) rows and \(n\) columns, its size, or dimensions, are written \(m\times n\), read “\(m\) by \(n\).” The first number always counts rows; the second counts columns. Thus an \(m\times n\) matrix has \(m\) horizontal rows and \(n\) vertical columns. In this course, \(m,n\in\mathbb{N}\), so both counts are positive.

Definition: A real \(m\times n\) matrix is a rectangular array of real entries with \(m\) rows and \(n\) columns. The set of all such matrices is written \(\mathbb{R}^{m\times n}\). If \(\mathbf{A}\in\mathbb{R}^{m\times n}\), its entry in row \(i\) and column \(j\) is denoted \(a_{ij}\), where \(1\le i\le m\) and \(1\le j\le n\). The first index specifies the row; the second specifies the column.

The notation \(\mathbf{A}=(a_{ij})\) indicates that the entries of \(\mathbf{A}\) are indexed by their row and column positions. In a displayed array, the first row is across the top and the first column is down the left. An index is a position label, not an instruction to multiply two numbers. For instance, \(a_{23}\) means “the entry in row 2, column 3,” not \(a\) multiplied by 2 and 3.

Worked Example: Determine the Size and Read Entries

For the matrix

$$ \mathbf{A}= \begin{bmatrix} 4 & -1 & 0\\ 2 & 5 & 7 \end{bmatrix}, $$

count the rows and columns, then find \(a_{12}\), \(a_{21}\), and \(a_{23}\).

The displayed array has two horizontal rows and three vertical columns, so \(\mathbf{A}\in\mathbb{R}^{2\times3}\). The entry \(a_{12}\) is in row 1, column 2. The first row is \((4,-1,0)\), so \(a_{12}=-1\). The entry \(a_{21}\) is in row 2, column 1, giving \(a_{21}=2\). The entry \(a_{23}\) is in row 2, column 3, giving \(a_{23}=7\).

Check: each first index is at most 2, the row count, and each second index is at most 3, the column count. The three values also agree with the stated row and column positions in the array.

Dimensions Describe Shape

The order of the two dimension numbers is not interchangeable. A \(2\times3\) matrix has two rows and three columns, whereas a \(3\times2\) matrix has three rows and two columns. The matrices have different shapes even if they contain the same number of entries. In general, an \(m\times n\) matrix has \(mn\) entry positions, but knowing the product \(mn\) alone does not determine the dimensions.

A matrix with the same number of rows and columns is called a square matrix. For example, a \(3\times3\) matrix is square; a \(2\times3\) matrix is not. This terminology describes shape only. It does not say anything about which values occur in the matrix.

Worked Example: Reconstruct a Matrix from Indexed Information

Write the \(3\times2\) real matrix whose entries satisfy \(a_{11}=6\), \(a_{12}=-2\), \(a_{21}=0\), \(a_{22}=4\), \(a_{31}=9\), and \(a_{32}=1\).

The dimension \(3\times2\) means there must be three rows and two columns. Place each prescribed value into the position indicated by its two indices. Row 1 consists of \(a_{11}=6\) followed by \(a_{12}=-2\), so it is \((6,-2)\). Row 2 consists of \(a_{21}=0\) and \(a_{22}=4\), so it is \((0,4)\). Row 3 consists of \(a_{31}=9\) and \(a_{32}=1\), so it is \((9,1)\). Therefore, the matrix is

$$ \mathbf{A}= \begin{bmatrix} 6 & -2\\ 0 & 4\\ 9 & 1 \end{bmatrix}. $$

Check: the displayed array has three rows and two columns. Reading its entries back gives \(a_{11}=6\), \(a_{12}=-2\), \(a_{21}=0\), \(a_{22}=4\), \(a_{31}=9\), and \(a_{32}=1\), as required.

When Are Two Matrices Equal?

For matrices to be equal, their entries must match at the same positions. It is not enough that they contain the same values somewhere in the arrays. Their dimensions must match first: if one matrix has a position that the other does not, there cannot be a corresponding entry to compare there.

Definition (Matrix equality): Matrices \(\mathbf{A}\in\mathbb{R}^{m\times n}\) and \(\mathbf{B}\in\mathbb{R}^{r\times s}\) are equal, written \(\mathbf{A}=\mathbf{B}\), exactly when \(m=r\), \(n=s\), and \(a_{ij}=b_{ij}\) for every \(i,j\) with \(1\le i\le m\) and \(1\le j\le n\).

This definition gives a two-part test: first confirm that the row counts and column counts agree, then compare all entries at matching indices. The word “all” matters. A single unequal corresponding entry is enough to show that the matrices are not equal.

Theorem (Entrywise test for equality): Let \(\mathbf{A}\in\mathbb{R}^{m\times n}\) and \(\mathbf{B}\in\mathbb{R}^{r\times s}\). Then \(\mathbf{A}=\mathbf{B}\) if and only if \(m=r\), \(n=s\), and \(a_{ij}=b_{ij}\) for every valid pair of indices.

Proof. Suppose first that \(\mathbf{A}=\mathbf{B}\). By the definition of matrix equality, equal matrices have the same number of rows and the same number of columns, so \(m=r\) and \(n=s\); their entries at every corresponding position are equal as well. Conversely, suppose \(m=r\), \(n=s\), and \(a_{ij}=b_{ij}\) at every position in these shared dimensions. The matrices then have the same shape and the same entry in each position. These are exactly the conditions in the definition of equality, so \(\mathbf{A}=\mathbf{B}\). \(\square\)

In the theorem, “if and only if” means that each direction has been established: equality requires matching dimensions and entries, and matching dimensions and entries guarantee equality. The dimension condition cannot be dropped, because the entrywise comparison is defined over the positions of an array with a particular shape.

Worked Example: Compare Matrices of the Same Size

Determine whether the following matrices are equal:

$$ \mathbf{A}= \begin{bmatrix} 1 & 0 & -3\\ 4 & 2 & 5 \end{bmatrix}, \qquad \mathbf{B}= \begin{bmatrix} 1 & 0 & -3\\ 4 & 2 & 5 \end{bmatrix}. $$

Both arrays have two rows and three columns, so \(\mathbf{A},\mathbf{B}\in\mathbb{R}^{2\times3}\). Compare the entries row by row. In row 1, the corresponding entries are \(1=1\), \(0=0\), and \(-3=-3\). In row 2, they are \(4=4\), \(2=2\), and \(5=5\). Thus every corresponding entry agrees and the dimensions match.

Conclusion and check: by the entrywise test, \(\mathbf{A}=\mathbf{B}\). The comparison covered all \(2\cdot3=6\) positions, and no position was omitted.

Worked Example: One Different Position Means Inequality

Decide whether these two \(2\times2\) matrices are equal:

$$ \mathbf{C}= \begin{bmatrix} 2 & 7\\ -1 & 3 \end{bmatrix}, \qquad \mathbf{D}= \begin{bmatrix} 2 & 7\\ -1 & 4 \end{bmatrix}. $$

Both matrices have two rows and two columns. Compare their corresponding entries: \(c_{11}=2=d_{11}\), \(c_{12}=7=d_{12}\), and \(c_{21}=-1=d_{21}\). At row 2, column 2, however, \(c_{22}=3\) while \(d_{22}=4\), and \(3\ne4\). The entrywise condition fails at that position, so \(\mathbf{C}\ne\mathbf{D}\).

Check: the dimensions agree, but equality requires agreement at every position, not merely at three of the four positions. The unequal entries \(3\) and \(4\) are a complete reason to conclude that the matrices are different.

Positions Matter, Not Just Values

Suppose two arrays contain the same numbers but place them in different positions. They need not be equal. For example, moving an entry from the first row to the second changes which indexed entry has that value. Similarly, writing the same row of values in a different order changes the corresponding entries. Matrix equality is therefore stricter than having the same collection of values.

A useful way to organize a comparison is to check the dimensions before inspecting individual entries. If the dimensions differ, the matrices are already unequal. If the dimensions agree, compare entries with matching indices. For a small matrix, a row-by-row check is practical; for a larger one, the definition still requires equality at every valid position.

Worked Example: Same Values, Different Shapes

Compare

$$ \mathbf{E}= \begin{bmatrix} 1 & 2 \end{bmatrix}, \qquad \mathbf{F}= \begin{bmatrix} 1\\ 2 \end{bmatrix}. $$

The matrix \(\mathbf{E}\) has one row and two columns, so \(\mathbf{E}\in\mathbb{R}^{1\times2}\). The matrix \(\mathbf{F}\) has two rows and one column, so \(\mathbf{F}\in\mathbb{R}^{2\times1}\). Their dimensions differ: \(1\ne2\) for the row counts, and \(2\ne1\) for the column counts. Therefore, they cannot be equal, even though both display the values 1 and 2.

Check: the entry \(e_{12}=2\) is in row 1, column 2, while the value 2 in \(\mathbf{F}\) is \(f_{21}\), in row 2, column 1. These are not corresponding positions, and the arrays do not even have matching dimensions.

Common Indexing and Equality Mistakes

Reversing the indices. In \(\mathbf{A}=\begin{bmatrix}4&-1&0\\2&5&7\end{bmatrix}\), a common incorrect reading is to say \(a_{23}=-1\), as though the first index gave the column and the second gave the row. The correction is to read the first index as the row and the second as the column: \(a_{23}\) is in row 2, column 3, so \(a_{23}=7\). The value \(-1\) is \(a_{12}\).

Ignoring dimensions. It is also incorrect to declare the \(1\times2\) matrix \(\begin{bmatrix}1&2\end{bmatrix}\) equal to the \(2\times1\) matrix \(\begin{bmatrix}1\\2\end{bmatrix}\) because they show the same values. The correction is to compare shape first: one has one row and two columns, and the other has two rows and one column. Since their dimensions differ, the matrices are unequal.

Checking only some entries. In the comparison of \(\mathbf{C}\) and \(\mathbf{D}\), the first three corresponding entries agree, but the bottom-right entries do not. It would be wrong to conclude equality after checking only the matching entries. The correction is to use the full condition: every corresponding entry must match. One mismatch is enough to rule out equality.

QuestionWhat to inspectConclusion
What is the matrix size?Count rows, then columnsWrite \(m\times n\)
What does \(a_{ij}\) mean?Row \(i\), then column \(j\)Read the entry at that position
Can different-sized matrices be equal?Compare row and column countsNo; both counts must match
Are same-sized matrices equal?Compare every corresponding entryYes exactly when all entries match

These checks give a reliable routine: record the row count first, the column count second, interpret each pair of indices in row-then-column order, and compare matrices only after confirming that their dimensions match. This keeps shape and position explicit and prevents the most common errors in reading matrix notation.

Check Your Understanding

Use row and column positions explicitly when answering each question.

  1. What are the dimensions of \(\begin{bmatrix}3&-2\\0&5\\4&1\end{bmatrix}\), and what is its entry \(a_{32}\)?
  2. Write the \(2\times3\) matrix with first row \((2,0,-1)\) and second row \((5,4,3)\) using indexed entries \(a_{ij}\).
  3. Can a \(2\times3\) matrix equal a \(3\times2\) matrix? Explain using the dimensions.
  4. Two \(2\times2\) matrices agree in entries \(a_{11},a_{12},a_{21}\) and \(b_{11},b_{12},b_{21}\), but \(a_{22}\ne b_{22}\). Are the matrices equal? State the criterion.
  5. Explain why having the same values in two arrays does not, by itself, guarantee that the matrices are equal.

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon