Press "Enter" to skip to content

How Many Triangles Are There? Here’s How to Solve the Puzzle

A couple of weeks ago, I wrote about a viral math problem — 8÷2(2+2) = ? — that drew the disdain of many mathematicians because it contained little actual math. In its place I described a more interesting math problem, offered by Po-Shen Loh of Carnegie Mellon University.

Unlike the viral “problem,” this puzzle did not hinge on misleading notation. In fact, there’s no notation at all, just a diagram and a question: How many triangles are formed by these six intersecting lines? (The caveat, evident in looking the diagram, is that no two lines are parallel, and there are no points where more than two lines intersect.) The challenge, ideally, was to figure out a procedure to calculate the answer, not to count carefully.

ImageCreditPo-Shen Loh

I did not reveal the answer, although I did provide a major hint from Dr. Loh: “A triangle is made of three lines. So if I have six lines, then the whole question becomes how can I pick three lines out of those six lines?”

On Twitter and in the comments on The Times’s website, it was clear that some readers knew immediately how to solve the problem because they had learned combinatorics, an area of math that figures out the number of ways things can be shuffled. Other readers just tried to count, an almost hopeless task. “I don’t think I’ve ever met anybody who’s counted right,” Dr. Loh said.

[Like the Science Times page on Facebook. | Sign up for the Science Times newsletter.]

To solve the problem, start with this observation: Any three lines in the diagram define one and only one triangle. It follows that the total number of triangles will be equal to the number of three-line combinations that can be chosen from a group of six lines.

How do you calculate that? Choose a line, any line. Since there are six lines, there are six choices. Next, choose a line to be the second side of the triangle. At first, you might think there are again six choices, but one line has already been chosen as a line for the first side, so only five choices are left. Likewise, for the third side of the triangle, there are four lines left to choose from.

Thus, the total number of ways you can choose the sides of the triangle equals 6×5×4, or 120. Clearly, there are not 120 triangles in the diagram. That’s because all of those combinations are being counted more than once.

For clarity, number the lines from 1 to 6, and look at the triangle defined by lines 1, 2 and 3. It’s the same triangle whether you choose line 1, then line 2, then line 3; or line 1, then line 3, then line 2.

Indeed, there are as many ways to create that triangle as there are ways to choose lines 1, 2 and 3. Jumble the digits every which way: 123, 132, 213, 231, 312, 321. There are six possibilities; likewise, any triangle in the diagram could be created six possible ways.

So now, divide out the redundancy. The total number of triangles created by those six lines is (6×5×4)/6, or 20. That’s the answer.

Here’s where math becomes powerful. The same procedure works for any number of lines. How many triangles are created by seven nonparallel lines? That’s (7×6×5)/6, or 35. What about 23 lines? (23×22×21)/6, or 1,771. How about 2,300 lines? That’s (2300×2299×2298)/6, which is a big number: 2,025,189,100.

The same calculation applies no matter how many lines there are. Compare that approach to brute-force counting, which is not only laborious and error-prone but provides no way to check the answer. Math produces the solution and the rationale for it.

It also reveals that other problems are, at heart, identical. Put balls of six different colors into a bag. Pull out three. How many different possible color combinations are there? 20, of course.

That’s combinatorics, and it’s useful for solving problems of this type. It comes with its own notation, to simplify the process of calculating, and involves a lot of exclamation points. The expression n! — “n factorial,” when said aloud — describes the product of multiplying all the integers from 1 to n. So 1! equals 1; 2! equals 2×1, or 2; 3! equals 3×2×1, or 6. And so on.

In the problem by Dr. Loh, the calculation for the number of triangles can be rewritten like this: 6!/(3!3!).

It can be written as C(6,3), which is read as “6 choose 3.” More broadly, it’s mathspeak for the number of ways to choose 3 items out of 6. It is generalized into this form:

C(n, r) = n!/((n–r)!r!)

That’s the equation that students memorize, the useful shortcut. Give it a closer look. The first part — n!/(n–r)! — is what captures the 6×5×4 in the triangle calculation. The r! is what eliminates the redundancies.

Which is to say, if you forgot the formula, you can reconstruct it by remembering what it’s supposed to solve. Therein lies the beauty of math, or part of it. A good equation is more than a recitation of rules; it expresses why those rules exist, reveals patterns and points to new problems to tackle.

Earlier reporting on mathematicsThe Math Equation That Tried to Stump the InternetAug. 2, 2019Why Mathematicians Hate That Viral EquationAug. 6, 2019Opinion | Richard A. FriedmanThe World’s Most Beautiful Mathematical EquationApril 15, 2017In Brazil, Mending an Urban Fabric With Geometry and BambooJuly 29, 2019


Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *