On this page
If you are preparing for a competitive exam like JEE Main or trying to solve a tricky permutations and combinations problem, counting shapes is a common hurdle. Instead of drawing out a shape and manually counting the lines crossing through it, you can use the mathematics of combinations.
A combination is a selection of items where the order of selection does not matter. We write the number of ways to choose k items from a set of n distinct items as nCk. By applying this simple idea to the vertices of a polygon, you can quickly find the number of lines, diagonals and triangles they form.
What is the formula for the number of diagonals in a polygon?
For an n-sided polygon, the total number of diagonals is given by the formula n(n − 3) / 2.
A diagonal is defined as a line segment joining any two non-adjacent vertices of a polygon. For example, a square has four sides (n = 4). According to the formula, it has 4(4 − 3) / 2 = 2 diagonals. A hexagon has six sides (n = 6), so it has 6(6 − 3) / 2 = 9 diagonals. A triangle (n = 3) has 3(3 − 3) / 2 = 0 diagonals, which makes sense because all its vertices are adjacent to each other.
If you struggle to recall whether the formula uses n − 3 or n − 2, the combination method (nC2) gives you a bulletproof way to build it from scratch.
How do you find the number of diagonals using nC2?
The quickest way to derive the number of diagonals is to use the combinations formula nC2 − n.
Here is the reasoning from combinatorial mathematics:
An n-sided polygon has n vertices.
A straight line is formed by connecting any two points. The total number of straight lines you can draw by connecting any two vertices is nC2.
These nC2 lines include the outer sides of the polygon and the diagonals criss-crossing inside.
Because the polygon has exactly n sides, you subtract n from the total lines to leave only the diagonals.
This gives the formula: Number of diagonals = nC2 − n
Let's expand nC2: nC2 = n(n − 1) / (2 × 1)
Substitute this back into the equation: nC2 − n = [n(n − 1) / 2] − n = (n² − n − 2n) / 2 = n(n − 3) / 2
If you find it hard to picture how combination formulas translate to shapes, the Fermi Concept Library contains interactive lessons for every concept in mathematics. Fermi's AI tutor can draw the figures and walk you through the logic step by step, making abstract ideas easier to see.
How do you find the number of triangles formed by the vertices of a polygon?
To form a triangle, you must choose exactly 3 distinct vertices from the n available points. Because the order in which you pick the three points does not change the triangle (triangle ABC is the same as triangle BCA), this is a combination problem.
The number of triangles formed by the vertices of an n-sided convex polygon is nC3.
For example, the number of triangles that can be formed using the vertices of a hexagon (n = 6) is: 6C3 = (6 × 5 × 4) / (3 × 2 × 1) = 20 triangles.
This same logic applies to other selection problems, such as finding the number of with and without replacement subsets, or understanding the power set and subsets.
How does the number of collinear points affect the lines formed?
Examiners often make these problems harder by placing the points on a plane rather than on a regular polygon, and stating that some of the points are collinear. Collinear points are a set of three or more points that lie on the same straight line.
If you have n points in a plane, and m of them are collinear, the calculations change:
Number of straight lines: You start with the maximum possible lines, nC2. The m collinear points should have formed mC2 distinct lines, but instead, they all lie on just one single line. So, you subtract mC2 and add 1.
Formula: nC2 − mC2 + 1
Number of triangles: You start with nC3. Any three points chosen from the m collinear points cannot form a triangle (their area is zero). Therefore, you must subtract all the invalid combinations formed by the collinear points, which is mC3.
Formula: nC3 − mC3
When you are practising these advanced variations, it is easy to make a wrong turn. The Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer. If you get stuck on the difference between combinations and arrangements with repeats, Fermi's AI tutor works out what you already know, builds a plan for the session, and teaches through it so you sit down to a clear next step.



