where 0≤x≤4 and 0≤y≤4 So, 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 =‌25C3 But, we must subtract the number of collinear triplets. Case I Horizontal lines Number of ways to choose 3 collinear points ⇒‌‌‌5C3=10 So, in 5 rows =5×10=50 Case II Vertical lines Same as above ⟶5 columns =5×10=50 Now, 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=20 And, diagonals from top-left to bottom-right =20 Total collinear triplets =50+50+20+20=140 So, total number of triangles =‌25C3−140 ⇒‌‌2300−140=2160