Answer: For an \(n\)-sided polygon, the number of diagonals is \(\frac{1}{2}n(n-3)\) for all integers \(n \geqslant 3\).
Let \(H_n\) be the statement: “An \(n\)-sided polygon has \(\frac{1}{2}n(n-3)\) diagonals.” We prove \(H_n\) by induction.
Base case: When \(n=3\), the polygon is a triangle. A triangle has no diagonals, and \(\frac{1}{2}\cdot 3(3-3)=0\). So \(H_3\) is true.
Inductive step: Assume \(H_k\) is true for some integer \(k \geqslant 3\). So a \(k\)-gon has \(\frac{1}{2}k(k-3)\) diagonals.
Now form a \((k+1)\)-gon by adding one new vertex to the \(k\)-gon. The new vertex can be joined to every existing vertex except its two adjacent vertices, so it creates \(k-1\) new diagonals.
Hence the total number of diagonals in the \((k+1)\)-gon is
\(\frac{1}{2}k(k-3) + (k-1) = \frac{k^2-3k+2k-2}{2} = \frac{k^2-k-2}{2} = \frac{(k+1)(k-2)}{2}.\)
Now \(\frac{(k+1)(k-2)}{2} = \frac{1}{2}(k+1)((k+1)-3)\), so the formula holds for \(k+1\).
Therefore \(H_k \Rightarrow H_{k+1}\).
Since \(H_3\) is true and \(H_k \Rightarrow H_{k+1}\), it follows by mathematical induction that an \(n\)-sided polygon has \(\frac{1}{2}n(n-3)\) diagonals for all integers \(n \geqslant 3\).