[Math] How many triangles can be formed using 10 points located in each of the sides (but not vertices) of a square

combinatorics

How many triangles can be formed using 10 points located in each of the sides (but not vertices) of a square?
There are a total of $40$ points.

Here's how I thought of it: First I have to choose the side for each vertex of the triangle, for the first one I have $4$ options, for the second one I have $4$ options as well, but for the third one I have $3$ options, as (I think) I can't form a triangle with $3$ points in a line.
Then, for each of those options I have 10 choices (each point from each side), so I thought the result would be $10^3 \cdot 4 \cdot 4 \cdot 3$, but then I'm not accounting for the triangles that are formed with vertices from $3$ different sides.
Any help/hints to how to think this is welcome.

The answer is supposed to be $10^3\binom{4}{3} + \binom{10}{2}\binom{10}{1} \cdot 2 \binom{4}{2}$. But I don't understand how to get there.

Best Answer

The first term is the number of triangles with vertices on different sides. The second term is the number of triangles with two vertices on the same side. We need to pick two sides, ordered $2\binom{4}{2}$. We need to pick $2$ points on one side $\binom{10}{2}$, and one point on the other $\binom{10}{1}$.