A couple of weeks ago I saw a simple problem in Facebook or Twitter. It was about how many triangles there are were in a picture. I started solving the problem with pen and pencil.
I think the original problem looked like this. The question was how many triangles you see in the picture.

I tried to think different methods how to solve the problem and of course how to generalize it. Finally, I decided to draw it with GeoGebra, so I could play with the problem more easily.
Now that I have played with the problem some time, I understood that you should also count how many intersection points, segments and quadrilaterals there are in the picture when you add more lines to it. And what about pentagons, hexagons, … when we add more horizontal lines?
To generalize it more I made a GeoGebra app with a slider n to add horizontal lines..
So, the question is. How many intersection points there are when the slider value is n in my app?
How many triangles and quadrilaterals?
What is easier for you, to make a simple function or recursive rule.
What about pentagons, heptagons…? You also have to decide if you allow the segments to be on the same line.


Is AHIJ a quadrilateral in this problem?

GeoGebra
For people who like to play with GeoGebra, I will show how I produced the app with using list and zip commans and some vector maths. The app does not solve the problem, but maybe it helps you how get the function or the recursive formulas for the problem.
First I created three points A, B and C and a slider n with integer values..

Then I created the point lists to segment AB, AC and BC with commands:
l1 = Sequence(A + nn Vector(A, B) / n, nn, 1, n – 1)
l2 = Sequence(A + nn Vector(A, C) / n, nn, 1, n – 1)
l3 = Sequence(B + nn Vector(B, C) / (n + 1), nn, 1, n)

With Zip command it is easy to join the points
Zip(Segment(AA, BB), AA, l1, BB, l2)
Zip(Segment(A, CC), CC, l3)

You can find the final app in GeoGebra Materials at https://www.geogebra.org/m/kn2vcesj