# Professor Rackbrane: Count the triangles

Professor Rackbrane has just given me the following puzzle as an example of those that interested his party at Christmas. Draw a pentagon, and connect each point with every other point by straight lines, as in the diagram.

How many different triangles are contained in this figure? To make it quite clear, AFB, AGB, ACB, BFG, BFC, and BGC, are six such triangles. It is not a difficult count if you proceed with some method, but otherwise you are likely to drop triangles or include some more than once.

This puzzle was made by Henry Dudeney.

• Curious readers may be interested in this Journal of Integer Sequences article: The Number of Triangles Formed by Intersecting Diagonals of a Regular Polygon. Apr 14 at 14:26
• @AndrewMorton : nice formula but : (1) not entirely trivial (2) only for triangles (3) only for regular polygons, That said: it perfectly matches OP indeed :-). However, some approaches given in answers work for more general cases (but then: they do not give a formula). Apr 14 at 23:44

We distinguish the triangles by how many of the short sides (ABCDEA) they use:

Zero short sides. These triangles are contained in the pentagram. There are 10 of them, BFG, EFC and rotations.
One short side. On side AB we can form triangles ABF, ABG and its reflection and ABD. This makes 20 triangles.
Two short sides. The short sides must be adjacent, so we have 5 triangles whose obtuse vertices are at each of the five pentagon vertices.
Three short sides. This is impossible.
So in total we have 35 triangles.

• +1 Your method (although different than mine) gave the same count. You used four cases depending on how many edges were used from the pentagon ABCDE. My method used four cases depending on how many vertices were used from pentagon ABCDE. Apr 11 at 7:51
• Whereas I did it by splitting according to how many of the "elementary" regions the triangle contains. (10 with 1, 10 with 2, 10 with 3, 5 with 5.) It's curious that three different ways of classifying the triangles all give four classes, even though they aren't the same classes. Apr 11 at 12:27
• @GarethMcCaughan I have posted my method; I encourage you to post yours. I feel it is valuable for people to see multiple ways of solving puzzles. Apr 11 at 16:54

I have a general method for counting triangles in an given figure.

Then I count all triangles from that vertex. The leftmost angle EÂD yields 3 triangles, DÂC yields 4 and CÂB yields 3 again.
Then grouping two angles, EÂC yields 2 and DÂB yields also 2.
Finally, the widest angle EÂB yields only 1.

Total 15 so far.

Then I erase corner A and proceed with B.

B yields 4 in EBD, 3 in DBC and 2 in the wide angle EBC.

Total 9, plus 15 above gives 24.

Then I erase corner B and continue with the rest:

C yields 2 + 3 + 1 = 6, D yields 1 + 2 + 1 = 4 and E yields only 1.
That is 11 more, resulting in a grand total of 35

It is probably overkill given the symmetry, but this method is really effective with irregular figures. In practice you don't erase, you can hide the discarded parts of the figure with your fingers.

• +1 What an interesting approach! Apr 11 at 21:08
• Would this work for counting quadrilaterals (or higher) as well ? I guess so. How many quadrilaterals do you count ? Apr 11 at 23:01
• It works very well for rectangles. It doesn't apply to this figure of course. To count arbitrary quadrilaterals, including convex ones, maybe also self-intersecting ones, you still have to be careful not to miss any. But in principle, yes, it helps you in the enumeration. Apr 12 at 8:05
• I applied your method to count number of quadrilaterals in OP given pentagon and get same number as using my method. I must say: your method first step is perhaps almost as tedious as counting all quadrilaterals in the pentagon. On the other hand, my method may be simpler to perform, but it requires more steps, which can also become tedious. Apr 12 at 21:57
• Oh, I didn't see what method you referred to. Yes, it is also general. The proof for mine is easy: the total count is the count of triangles touching A plus the count of those not touching A. The second value being then split between those touching B and those not touching B. etc. Apr 12 at 22:16

Here is a slightly different solution which focuses on vertices:

The vertices of the triangles we are to count are from the vertices of the outer pentagon ABCDE and/or inner pentagon (partially labelled FG).

Case 1: Three vertices are from outer pentagon.

5 triangles like ABC. 5 triangles like ABD. CASE TOTAL: 10 triangles.

Case 2: Two vertices are from outer pentagon.

5 triangles like AFB. 10 triangles like AGB. 5 triangles like EFC.
CASE TOTAL: 20 triangles.

Case 3: One vertex is from outer pentagon.

5 triangles like BFG. CASE TOTAL: 5 triangles.

Case 4: No vertex is from outer pentagon.

No such triangles.

GRAND TOTAL: 35 TRIANGLES.

At OP's request, here's another way of organizing the calculation. I don't claim that it's any better than the others already presented in other answers.

We split according to the number of elementary regions making up the triangle, where an "elementary region" is one of the connected components of what you get after deleting all the edges.

1 region: two types of triangle (ABF-like, BFG-like), 5 of each. 10 triangles in all.

2 regions: one type of triangle (ABG-like), 10 of them.

3 regions: two types of triangle (ABE-like, BCD-like), 5 of each. 10 triangles in all.

5 regions: one type of triangle (ACD-like), 5 of them.

Total is 10+10+10+5 = 35.

• Answers focus on simplifying and cataloging according to triangles, vertices, regions, cuts etc... I up-voted all answers accordingly, because, indeed, no answer is necessarily better for simple OP problem at hand. Myself I rather focus on (potentially equal) edges. Now, one appreciation argument might be: generalize for other $n$ and $m$ than given $3$ and $5$, and/or for other than given regular polygon. All answered methods may or may not have some advantages and/or some disadvantages for such road to take and appreciation mileages may vary. Apr 14 at 1:56

There are:

5 sides like AB each belonging to 6 triangles

5 sides like FG each belonging to 1 triangle

10 sides like AF each belonging to 3 triangles

10 sides like AG each belonging to 2 triangles

5 sides like AC each belonging to 4 triangles

note

each triangle is mentioned only by its 3 sides above

giving

$$6*5+1*5+3*10+2*10+4*5 = 105$$ triangle sides

meaning

$$105/3=35$$ triangles

same reasoning might also help for other, similar, figures, and, perhaps, not only for counting triangles.

same reasoning finds $$20$$ quadrilaterals in the pentagon