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$.

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.