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

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 its 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!/((nr)!r!)

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