# Main diagonal

Main diagonal (red) and secondary diagonals (blue) of a (4 × 4) matrix

In mathematics, the main diagonal of a matrix consists of those elements of the matrix that lie on an imaginary line running diagonally from the top left at 45 ° to the bottom right. The diagonals of the matrix that run parallel to the main diagonal are referred to as the secondary diagonals of the matrix. The diagonal of a matrix, which instead runs from top right to bottom left, is called the opposite diagonal of the matrix.

## definition

The main diagonal of a matrix

${\ displaystyle A = {\ begin {pmatrix} a_ {1,1} & a_ {1,2} & \ ldots & a_ {1, n} \\ a_ {2,1} & a_ {2,2} & \ ldots & a_ {2, n} \\\ vdots & \ vdots && \ vdots \\ a_ {m, 1} & a_ {m, 2} & \ ldots & a_ {m, n} \ end {pmatrix}}}$

consists of those entries in the matrix that are on the diagonal from top left to bottom right. These are the entries with , i.e. precisely those matrix entries in which the row and column index match. ${\ displaystyle a_ {k, k}}$${\ displaystyle 1 \ leq k \ leq \ min \ {m, n \}}$${\ displaystyle a_ {i, j}}$

## Examples

The main diagonal of the matrix

${\ displaystyle A = {\ begin {pmatrix} 1 & 4 & 2 & 1 \\ 3 & 0 & 3 & 1 \\ 5 & 1 & 2 & 0 \\ 4 & 1 & 2 & 3 \ end {pmatrix}}}$

consists of the four entries and . ${\ displaystyle 1,0,2}$${\ displaystyle 3}$

The following 3 matrices have their main diagonal marked with red ones.

${\ displaystyle {\ begin {pmatrix} \ color {red} {1} & 0 & 0 \\ 0 & \ color {red} {1} & 0 \\ 0 & 0 & \ color {red} {1} \ end {pmatrix}} \ qquad { \ begin {pmatrix} \ color {red} {1} & 0 & 0 & 0 \\ 0 & \ color {red} {1} & 0 & 0 \\ 0 & 0 & \ color {red} {1} & 0 \ end {pmatrix}} \ qquad {\ begin { pmatrix} \ color {red} {1} & 0 & 0 \\ 0 & \ color {red} {1} & 0 \\ 0 & 0 & \ color {red} {1} \\ 0 & 0 & 0 \ end {pmatrix}}}$

## use

A square matrix in which only the elements on the main diagonal are different from zero is called a diagonal matrix . If all of these elements have the value one, the so-called identity matrix results . The sum of the main diagonal elements is called the trace of the matrix. A symmetrical matrix is a matrix that is symmetrical about its main diagonal.

The term "secondary diagonal" has no uniform definition and can refer to a diagonal that runs parallel to the main diagonal above or below it, or to one of the counter- diagonals of the matrix that run from top right to bottom left.

The main diagonal plays a special role in calculating the determinant of a matrix. With a matrix, the determinant is the product of the main diagonal elements minus the product of the counter diagonal elements. In the case of a matrix, the determinant can be calculated using Sarrus' rule , in which the main, secondary and counter diagonals are considered. With a triangular matrix of any size, the determinant results directly as the product of the main diagonal elements. ${\ displaystyle (2 \ times 2)}$${\ displaystyle (3 \ times 3)}$