For a polygon, a diagonal is a line segment connecting two nonadjacent vertices or two vertices that are not next to each other.
Below, we show all the diagonals for a rectangle and a pentagon. There are two diagonals in the rectangle and five diagonals in the pentagon.
For a polyhedron or solid figure, a diagonal is a line segment connecting two vertices that are in different faces.
The following image shows a diagonal for the rectangular prism.