Is this the correct formula? And is there any better approach to solve this problem?

If n is the number of sides in any polygon, then;

Number of Diagonals in any polygon = n(n−3)/2

Number of Diagonals which are Parallel to any of the sides = n(n−4)/4

Number of Diagonals which are Non-Parallel to any of the sides = n(n−2)/4

This can be visualized in a much better way. The number of diagonals for any polygon with n sides will be:

take the number of diagonals that can be drawn at max from a vertex. Multiply this by the number of sides n. Divide this by 2 since the diagonals of opposite vertices are the same! Since they cancel out we need to divide this by 2.

For example, in the case of an octagon, the max number of diagonals we can draw from a vertex is 5. Multiply this by 8, the number of sides, and divide this by 2 (reason stated as previous). The answer is 20 which is the same in case of the formula too. Also in case the n value increases, we can very well calculate the no of diagonals using the logic that for any given polgon, max no of diags possible from a vertex is (n-3) [ that is where the formula is derived too!] This can be extended to parallel and non-parallel conditions also.

1 Like