How many triangles can be formed from $9$ points which some are collinear

The following diagram shows 9 distinct points chosen from the sides of a triangle.

$(1)$ How many line segments are there joining any two points on different sides?

$(2)$ How many triangles can be formed from these points?

I manage to solve $(1)$, by considering the following:

Fix one end of a line at the hypotenuse. Then it has $5$ choices for another end. Since there are $4$ points on hypotenuse, we have $5 \times 4$.

Fix one end of a line at the bottom length of the triangle. Then we have $2 + 2 + 2 = 6$ lines formed between bottom and left side of the triangle.

By the addition principle, we have $20+6=26$ lines formed.

But I don't know how to start $(2)$, as we can have two vertices of a triangle lie on the same side. This extra situation confuses me.

Answer to $(2)$ is $79$.

• For (1), $2\cdot3+2\cdot4+3\cdot4=26$, indeed. – Yves Daoust Dec 2 '16 at 9:12
• Is the answer 70?? – Rohan Dec 2 '16 at 9:17
• No, answer is $79$ – Idonknow Dec 2 '16 at 9:17

By the following arrangement we have $2,3,4$ points on each side of the triangle. There are a total of $9$ points. Select any $3$ from them. Total number of ways are: $\binom{9}{3} = 84$. Number of collinear point selection cases: $\binom{2}{3} +\binom{3}{3} +\binom{4}{3} = 5$ ways. Totally $84-5 = 79$ ways. Hope it helps.

With all vertices on different sides, you form $2\cdot3\cdot4$ triangles.

With two vertices on the same side, you form $1,3$ and $6$ pairs respectively; then you can match every pair with a vertex on another side, giving

$$1\cdot(3+4)+3\cdot(2+4)+6\cdot(2+3).$$

Total $79$.

(I assume that we can rule out the $0+1+4$ flat triangles obtained with three vertices on the same side.)

The approach by @Rohan is better: from all $9\cdot8\cdot7/6$ possible triangles, discard the $0+1+4$ degenerate ones.

• Why do you have $2$ times $(3+4)$, when you've noted that there's only one way to choose two points on the side with only two points? (I was about to write almost the same). – Henrik Dec 2 '16 at 9:24
• @Henrik: thanks, you spotted my mistake. – Yves Daoust Dec 2 '16 at 9:25