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.

See also
Key Formula
Main diagonal entries: aiifor i=1,2,3,…,min(m,n)
Where:
- aii = The element in row i and column i of the matrix
- i = The index that runs from 1 up to the smaller of the number of rows or columns
- m = The number of rows in the matrix
- n = 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=438156729
Step 2: Identify the entries where the row number equals the column number. These are the main diagonal entries.
a11=4,a22=5,a33=9
Step 3: Visually, these entries form a line from the top-left corner to the bottom-right corner of the matrix.
438156729
Step 4: The sum of the main diagonal entries is called the trace. Add the diagonal entries together.
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=[1083206514]
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
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=20
Step 4: Highlight them in the matrix.
[1083206514]
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,…,akk where 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×n matrix, the anti-diagonal entries are a1,n,a2,n−1,…,an,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. 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 Diagonal | Anti-Diagonal | |
|---|---|---|
| Direction | Top-left to bottom-right | Top-right to bottom-left |
| Entry indices (n×n matrix) | a11,a22,…,ann | a1n,a2,n−1,…,an1 |
| Index rule | Row index = column index (i=j) | Row index + column index = n+1 |
| Used in | Trace, diagonal matrices, identity matrices, determinants | Certain 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=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×5 matrix has 3 main diagonal entries (a11,a22,a33), and a 5×3 matrix also has 3. The count is always min(m,n).
Related Terms
- Matrix — The structure whose diagonal is being identified
- Element of a Matrix — Individual entries that make up the diagonal
- Diagonal Matrix — A matrix with nonzero entries only on the main diagonal
- Identity Matrix — Diagonal matrix with all main diagonal entries equal to 1
- Trace — Sum of the main diagonal entries of a square matrix
- Triangular Matrix — Has zeros above or below the main diagonal
- Determinant — Diagonal entries play a key role in determinant calculation
