The formula to calculate the number of diagonals in a polygon with \( n \) sides is: \[ \text{Number of diagonals} = \frac{n(n - 3)}{2} \]
Step 1: In an octagon, \( n = 8 \).
Step 2: Apply the formula: \[ \text{Number of diagonals} = \frac{8(8 - 3)}{2} = \frac{8 \times 5}{2} = \frac{40}{2} = 20 \] Thus, the number of diagonals in an octagon is 20.