## Task A-4.3.

On the edge of a square, a total of $4 n$ points are marked: all four vertices of the square and an additional $n-1$ points on each side of the square. Determine the number of all (non-degenerate) triangles for which the marked points are vertices.
## First solution.

From the given $4 n$ points, we can choose three points in $\binom{4 n}{3}$ ways.

However, these three points will be vertices of a triangle only if they do not lie on the same side. (1 point) Let's count how many ways we can choose three points on one side of the square. Since there are $n+1$ points on each side (including the vertices), this can obviously be done in $\binom{n+1}{3}$ ways.

(3 points)

The same applies to each of the four sides of the square, so the previously obtained number must be reduced by $4 \cdot \binom{n+1}{3}$.

(1 point)

Finally, the number of triangles is $\binom{4 n}{3} - 4 \binom{n+1}{3}$.

![](https://cdn.mathpix.com/cropped/2024_05_30_ac8e994af6b309923da1g-05.jpg?height=469&width=479&top_left_y=1339&top_left_x=777)