Let the triangle be
ABC with point
(x,y),
where
0≤x≤4 and
0≤y≤4So, the points
(x,y) are
(0,0),(0,1),(0,2),(0,3),(0,4),(1,0),(1,1),(1,2),(1,3),(1,4),(2,0),(2,1),(2,2),(2,3),(2,4),(3,0),(3,1),(3,2),(3,3),(3,4),
(4,0),(4,1),(4,2),(4,3),(4,4).
Total coordinates are 25 , but we need to select only 3 .
Now, the number of triangles with sets of 3 non-collinear points. Total number of ways to choose 3 points
=‌25C3But, we must subtract the number of collinear triplets.
Case I Horizontal lines
Number of ways to choose 3 collinear points
⇒‌‌‌5C3=10So, in 5 rows
=5×10=50Case II Vertical lines
Same as above
⟶5 columns
=5×10=50Now, diagonal from bottom-left to top-right
= Length
3:2 such diagonals + Length
4 : 2 diagonals + Length 5:1 diagonal
=‌2(‌3C3)+2(‌4C3)+‌5C3‌2(1)+2(4)+10=‌2+8+10=20And, diagonals from top-left to bottom-right
=20Total collinear triplets
=50+50+20+20=140So, total number of triangles
=‌25C3−140⇒‌‌2300−140=2160