Mathwords logoMathwords

Main Diagonal of a Matrix

Main Diagonal of a Matrix

The elements of a matrix starting in the upper left corner and proceeding down and to the right.

 

3x3 matrix with elements 1-9; main diagonal highlighted from top-left to bottom-right: 1, 5, 9, labeled "main diagonal.

 

 

See also

Diagonal matrix, identity matrix

Key Formula

Main diagonal entries: aiifor i=1,2,3,,min(m,n)\text{Main diagonal entries: } a_{ii} \quad \text{for } i = 1, 2, 3, \ldots, \min(m, n)
Where:
  • aiia_{ii} = The element in row i and column i of the matrix
  • ii = The index that runs from 1 up to the smaller of the number of rows or columns
  • mm = The number of rows in the matrix
  • nn = The number of columns in the matrix

Worked Example

Problem: Identify the main diagonal entries of the matrix A and find their sum (the trace).
Step 1: Write down the matrix A.
A=[417352869]A = \begin{bmatrix} 4 & 1 & 7 \\ 3 & 5 & 2 \\ 8 & 6 & 9 \end{bmatrix}
Step 2: Identify the entries where the row number equals the column number. These are the main diagonal entries.
a11=4,a22=5,a33=9a_{11} = 4, \quad a_{22} = 5, \quad a_{33} = 9
Step 3: Visually, these entries form a line from the top-left corner to the bottom-right corner of the matrix.
[417352869]\begin{bmatrix} \boxed{4} & 1 & 7 \\ 3 & \boxed{5} & 2 \\ 8 & 6 & \boxed{9} \end{bmatrix}
Step 4: The sum of the main diagonal entries is called the trace. Add the diagonal entries together.
tr(A)=4+5+9=18\text{tr}(A) = 4 + 5 + 9 = 18
Answer: The main diagonal entries are 4, 5, and 9. Their sum (the trace) is 18.

Another Example

This example uses a non-square (rectangular) matrix to show that the main diagonal still exists but contains fewer entries than either dimension of the matrix.

Problem: Find the main diagonal entries of the non-square (rectangular) matrix B.
Step 1: Write down the matrix B, which has 2 rows and 4 columns.
B=[1036182054]B = \begin{bmatrix} 10 & 3 & 6 & 1 \\ 8 & 20 & 5 & 4 \end{bmatrix}
Step 2: Determine the number of main diagonal entries. Since B is a 2×4 matrix, the diagonal has min(2, 4) = 2 entries.
min(m,n)=min(2,4)=2\min(m, n) = \min(2, 4) = 2
Step 3: Pick out the entries where the row index equals the column index: row 1 column 1, and row 2 column 2.
b11=10,b22=20b_{11} = 10, \quad b_{22} = 20
Step 4: Highlight them in the matrix.
[1036182054]\begin{bmatrix} \boxed{10} & 3 & 6 & 1 \\ 8 & \boxed{20} & 5 & 4 \end{bmatrix}
Answer: The main diagonal entries are 10 and 20.

Frequently Asked Questions

Does a non-square matrix have a main diagonal?
Yes. Even if a matrix has a different number of rows and columns, the main diagonal still exists. It consists of the entries a11,a22,,akka_{11}, a_{22}, \ldots, a_{kk} where k=min(m,n)k = \min(m, n). The diagonal simply stops when you run out of rows or columns.
What is the difference between the main diagonal and the anti-diagonal of a matrix?
The main diagonal runs from the top-left corner to the bottom-right corner (entries where row index equals column index). The anti-diagonal (sometimes called the secondary diagonal) runs from the top-right corner to the bottom-left corner. For an n×nn \times n matrix, the anti-diagonal entries are a1,n,a2,n1,,an,1a_{1,n}, a_{2,n-1}, \ldots, a_{n,1}.
What is the trace of a matrix and how does it relate to the main diagonal?
The trace of a square matrix is the sum of all its main diagonal entries: tr(A)=a11+a22++ann\text{tr}(A) = a_{11} + a_{22} + \cdots + a_{nn}. It is defined only for square matrices. The trace is important in linear algebra because it is invariant under change of basis and equals the sum of the matrix's eigenvalues.

Main Diagonal vs. Anti-Diagonal

Main DiagonalAnti-Diagonal
DirectionTop-left to bottom-rightTop-right to bottom-left
Entry indices (n×n matrix)a11,a22,,anna_{11}, a_{22}, \ldots, a_{nn}a1n,a2,n1,,an1a_{1n}, a_{2,n-1}, \ldots, a_{n1}
Index ruleRow index = column index (i=ji = j)Row index + column index = n+1n + 1
Used inTrace, diagonal matrices, identity matrices, determinantsCertain determinant formulas, matrix reflections

Why It Matters

The main diagonal appears constantly in linear algebra and beyond. Diagonal matrices, identity matrices, and triangular matrices are all defined in terms of the main diagonal. When you compute a determinant, find eigenvalues, or calculate the trace, you work directly with these entries. Understanding the main diagonal is essential for nearly every matrix operation you will encounter.

Common Mistakes

Mistake: Confusing the main diagonal with the anti-diagonal, especially in larger matrices.
Correction: Remember: the main diagonal always goes from top-left to bottom-right. The entries satisfy i=ji = j (row number equals column number). The anti-diagonal goes the opposite way.
Mistake: Assuming every matrix must be square to have a main diagonal.
Correction: Rectangular matrices also have a main diagonal. A 3×53 \times 5 matrix has 3 main diagonal entries (a11,a22,a33a_{11}, a_{22}, a_{33}), and a 5×35 \times 3 matrix also has 3. The count is always min(m,n)\min(m, n).

Related Terms

  • MatrixThe structure whose diagonal is being identified
  • Element of a MatrixIndividual entries that make up the diagonal
  • Diagonal MatrixA matrix with nonzero entries only on the main diagonal
  • Identity MatrixDiagonal matrix with all main diagonal entries equal to 1
  • TraceSum of the main diagonal entries of a square matrix
  • Triangular MatrixHas zeros above or below the main diagonal
  • DeterminantDiagonal entries play a key role in determinant calculation