The diagonal is the hypotenuse of a right triangle
Draw a rectangle's diagonal, and it splits the rectangle into two right triangles. The rectangle's length and width become the two shorter sides of that triangle, and the diagonal itself is the hypotenuse — so the same formula that finds a right triangle's longest side also finds a rectangle's diagonal: diagonal = √(length² + width²).
A worked example, 8 by 5
For an 8-by-5 rectangle: diagonal = √(8² + 5²) = √(64 + 25) = √89 ≈ 9.4340 (rounded to 4 decimal places). The diagonal is longer than either side individually, since it cuts across the rectangle rather than along one edge.
A square's diagonal is the same formula, simplified
Since a square is a rectangle with equal length and width, its diagonal uses the same formula with both sides equal. For a side of 5: diagonal = √(5² + 5²) = √50 ≈ 7.0711. This matches the general rule that a square's diagonal is always its side length times √2 — 5 × 1.41421... ≈ 7.0711, the same answer either way.
Why a bigger area doesn't always mean a longer diagonal
A 10-by-4 rectangle has a diagonal of √(10² + 4²) = √116 ≈ 10.7703, longer than the 8-by-5 rectangle's ≈9.4340 diagonal — even though both rectangles have the exact same area (40). The diagonal depends on how the length and width are individually spread apart, not on their product, so two shapes with identical areas can still have noticeably different diagonal lengths.