As applied to a polygon, a diagonal is a line segment joining two vertices that are not adjacent. Therefore a quadrilateral has two diagonals, joining opposite pairs of vertices. For a convex polygon the diagonals run inside the polygon. This is not so for re-entrant polygon s. In fact a polygon is convex if and only if the diagonals are internal.
When n is the number of vertices in a polygon and d is the number of possible different diagonals, each vertex has possible diagonals to all other vertices save for itself and the two adjacent vertices, or n-3 diagonals; this multiplied by the number of vertices is
- (n − 3) × n,
which counts each diagonal twice (once for each vertex) — therefore,
In the case of a square matrix, the main or principal diagonal is the diagonal line of entries running north-west to south-east. For example the identity matrix can be described as having entries 1 on main diagonal, and 0 elsewhere. The north-east to south-west diagonal is sometimes described as the minor diagonal. A superdiagonal entry would be one that is above, and to the right of, the main diagonal.
By analogy, the subset of the Cartesian product X×X of any set X with itself, consisting of all pairs (x,x), is called the diagonal. It is the graph of the identity relation. It plays an important part in geometry: for example the fixed points of a mapping F from X to itself may be obtained by intersecting the graph of F with the diagonal.
Quite a major role is played in geometric studies by the idea of intersecting the diagonal with itself: not directly, but by passing within an equivalence class. This is related at quite a deep level with the Euler characteristic and the zeroes of vector fields. For example the circle S1 has Betti numbers 1, 1, 0, 0, 0, ... and so Euler characteristic 0. A geometric way of saying that is to look at the diagonal on the two-torus S1xS1; and to observe that it can move off itself by the small motion (θ, θ) to (θ, θ + ε).