How To Really Solve The Straight Lines And Triangles Puzzle? - An image showing four straight lines that intersect each other at a unique point. At any point of intersection, no more than two lines are involved. On top of this illustration, the following question is posed: "HOW MANY TRIANGLES?"

The straight lines and triangles puzzle follows directly from my essay on the quadratic equation magic trick. In this puzzle, your job is to figure out how many triangles you can construct using ’n’ straight lines.

The following are the conditions of the puzzle:

1. No two lines shall be parallel to each other.

2. Each line shall intersect every other line.

3. Any intersection point shall involve no more than two straight lines.

Given these conditions, how would you proceed? As a hint, you may look for a clue in the essay that I linked at the beginning.

Spoiler Alert:

If you wish to solve this puzzle on your own without any further clues, now is a good time to tune off of this essay. Once you are done, you may choose to continue reading this essay. Beyond this section, I will be discussing direct solutions to this puzzle.

This essay is supported by Generatebg

A product with a beautiful background featuring the sponsor: Generatebg - a service that generates high-resolution backgrounds in just one click. The description says "No more costly photographers" and displays a "Get Started" button beneath the description.

Trial and Error with Straight Lines and Triangles

Let us start with the classic trial and error approach. But even before that, using geometric logic alone, we could establish that we can construct no triangle using less than three straight lines. So, the solution that we are looking for is likely an expression that yields zero for n = 0,1, and 2 respectively.

Let us now see what happens when we have three straight lines that follow the conditions of the puzzle:

How To Really Solve The Straight Lines And Triangles Puzzle? — An illustration with three lines, each of which intersects every other line. All the intersection points involve two lines only. It is seen that this arrangement creates one triangle at the centre.
Illustration created by the author

As we can clearly see, this leads to a situation where we can construct one solitary triangle. So, the expression we are looking for yields the result of 1 for n = 1.

Let us now see what happens when we have four lines:

How To Really Solve The Straight Lines And Triangles Puzzle? — An illustration with four lines, each of which intersects every other line. All the intersection points involve two lines only. It is seen that this arrangement constructs 4 triangles in total. The method of working this out involves highlighting each triangle using separately coloured highlighters. This process might involve trial and error.
Illustration created by the author

We see from the illustration that we can construct a total of four lines under the conditions of the puzzle. Let us now take it one step further and see what the problem space with five straight lines looks like:

How To Really Solve The Straight Lines And Triangles Puzzle? — An illustration with five lines, each of which intersects every other line. All the intersection points involve two lines only. It is seen that this arrangement constructs 10 triangles in total. The method of working this out involves highlighting each triangle using separately coloured highlighters. This process might involve trial and error.
Illustration created by the author

It took a lot more effort and it looks a lot messier. However, we do have an answer in the end. We can construct a total of 10 triangles using 5 straight lines under the given conditions.

We could keep going, but not only does it get significantly more cumbersome, but now we have sufficient data to try and workout the underlying expression.


Using Calculus of Finite Differences to Solve the Straight Lines and Triangles Puzzle

As I had hinted at the beginning of the essay, we are going to employ the calculus of finite differences to workout the underlying expression. Let us first write down the results we have and construct the inverted pyramid:

How To Really Solve The Straight Lines And Triangles Puzzle? — An image showing the method of differences using an inverted pyramid. In the first row, the number of straight lines are listed as: 0, 1, 2, 3, 4, 5. In the second row, the corresponding no. of triangles are listed: 0,0,0,1,4,10. The corresponding first row of differences reads: 0,0,1,3,6. Second row of differences: 0,1,2,3. Third row of differences: 1,1,1.
Math illustrated by the author

We have ended up with alike numbers in the third row of differences. What this means is that the expression we are looking for is cubic.

Likewise, if we had ended up with alike numbers in the second row of differences, the expression would be quadratic. And if it had been in the first row of differences, our expression would have been linear. In short, the number of rows of differences is equal to the order of the expression we are looking for.

The Genius of Newton

Luckily, for the method we are pursuing, Isaac Newton had come up with a formula that works well. If we express the value of the expression for n = 0 as ‘a’, the first number in the first row of differences as ‘b’, the first number in the second row of differences as ‘c’, and so on, Newton’s formula is as follows:

How To Really Solve The Straight Lines And Triangles Puzzle? — a + bn + cn(n-1)/2 + dn(n-1)(n-2)/(2*3) + …
Math illustrated by the author

If we plug in the values we have from our inverted pyramid, we end up with the following expression:

How To Really Solve The Straight Lines And Triangles Puzzle? — n(n-1)(n-2)/6
Math illustrated by the author

If you look at this closely, this expression is none other than the value of nC3 (where C is the combination function from combinatorics). This is because our geometric puzzle could be essentially transformed as the following question:

How many combinations of groups of three straight lines from a total of ’n’ straight lines are possible?

If it was so simple to transform the puzzle into this question and get the answer using combinatorics, why did I not reveal it until this point? The reason is that this puzzle serves as a good step into the world of the calculus of finite differences.

Having come this far, let us take a look at some of the finer properties of the method of finite differences.


A Finer Look into the Method of Finite Differences

Here is a recap of how I solved the puzzle:

1. I used trial and error to get the pattern of the outputs for inputs from an arithmetic series.

2. I then used the method of finite differences to work out the expression that fits the observed output.

One point to note about this approach is that even though this is very effective, my solution is still just a “guess”. Until I prove that the pattern holds indefinitely, this remains the case.

In short, the method of differences is only as good as the validity of the pattern observed. This presents problems when we try to apply this method to real-world problems. We often end up with expressions that are true until they are not.

Often, no finite amount of data can sufficiently prove the validity of a pattern. And just one data point is sufficient to disprove the pattern observed until that point. As mathematician George Pólya put it:

“Nature may answer Yes or No, but it whispers one answer and thunders the other.”

Another point to note about this method is that it works only for polynomial expressions. Had our original expression been exponential, the consequent rows of differences would lead to recursive spirals.

Final Thoughts

Westarted with straight lines and triangles and ended up stepping into the world of the calculus of finite differences. Along the way, we covered some of its finer properties and limitations.

Even considering the limitations, the method of differences happens to be used in studying real-world phenomenanumerical algorithms, and iterative mathematical schemes, among others.

Now that you have had exposure to this method, what do you think you could use it for?


References and Credit: Martin Gardner.

If you’d like to get notified when interesting content gets published here, consider subscribing.

Further reading that might interest you: How To Generate Any Number Using Four 4s? and Newcomb’s Paradox — A Challenge To Game Theory.

If you would like to support me as an author, consider contributing on Patreon.

Street Science

Explore humanity's most curious questions!

Sign up to receive more of our awesome content in your inbox!

Select your update frequency:

We don’t spam! Read our privacy policy for more info.