How many possible triangles can be made in a $3 \text{Dimensional}$ Array of points? Say I have an array of points $5$ wide, $5$ deep, and $5$ high (A lattice)
I understand to find how many ways to connect those points is ${125}\choose{3}$$ = 317750,$ but how would I find only the non-degenerate triangles?
 A: You're looking to find the complement of the set of collinear triples, which are the degenerate triangles.
There are three basic classes: Triples on the grid lines, triples on the $45°$ plane diagonals and space "unit" diagonals (that cross unit cubes vertex to vertex), and triples on other diagonals.
The first set are easy to calculate; there are $75$ grid lines running through your lattice, $25$ in each orientation, so there are $75\binom 53$ options there.
Then the plane unit diagonals have $2(\binom 53+ 2 \binom 43+2)$ options each for the $15$ grid planes, and the space unit diagonals can be reckoned up by considering the plane sections tipped at $45°$ and $-45°$ to one axis giving $3\times 5$, $4\times 5$, $5\times 5$, $4\times 5$, and $3\times 5$ rectangles which have $(2\cdot 6 + 2(4\binom 43 + 4) + 2(\binom 53+ 2 \binom 43+2) )$ unit diagonal collinear triples.
Finally the non-unit diagonal triples need to have an increment of $2$ in one or two of the ordinates. These triples thus all reach across the full lattice. The unordered, unsigned increment options are  $(1,2,2)$, $(1,1,2)$, $(0,1,2)$, since the  $(2,2,2)$,  $(0,2,2)$ and  $(0,0,2)$ are unit diagonal vectors.
Then for example you will have three options each for  $(1,2,2)$,  $(1,-2,2)$,  $(1,2,-2)$,  $(1,-2,-2)$, because the $1$ increment allow three starting positions in each case. The other two positions of unit increment give $12$ more options each. From similar arguments you will have $9$ options for each of $12$ variations on  $(1,1,2)$ and $15$ options on each of the $12$ variations on $(0,1,2)$.
Total collinear triples is then $$75{\small\binom 53} +15\cdot 2({\small\binom 53}+ 2 {\small\binom 43}+2) + 2(2\cdot 6 + 2(4{\small\binom 43} + 4) + 2({\small\binom 53}+ 2 {\small\binom 43}+2) ) \\ + (3\cdot 12+9\cdot 12+15\cdot 12) \\ 
= 750+ 600 + 184+ 324 \\
= 1858 $$
And all other triples are non-degenerate triangles.
