How many different triangles with at least a $3$ vertex side in a $3 \times 3$ vertex grid? Say we have $3 \times 3$ vertex grid like so:
*    *    *

*    *    *

*    *    *

How many triangles exist so that at least one of their sides passes through 3 vertices and the corners of the triangles must be on asterisks? I am not sure if this is even possible to find using combinatorics.
 A: Suppose that one line is like  
*---*---* 

*   *   *  

*   *   *  

In such a case, we have 6 options for the 3rd vertex. And, there a total of 6 such lines(both horizontal and vertical). So we have $6 \times 6 = 36$ such triangles. However we over counted the cases like:  
*---*---* 
|
*   *   *  
|
*   *   *  

There are $4$ extra cases, so we have $36 - 4 = 32$ such triangles. Now if the first line we draw is a diagonal, then we have $4$(not 6 because we dont want to choose the corner) choices for each diagonal i.e. $4\times 2 = 8$ possibilities.
$$32 + 8 = \boxed{40}$$
A: You can pick three asterisks in $9 \choose 3$ ways.  They will form a triangle unless they are in a straight line.  How many straight lines of three asterisks are there?
A: Starting with the edge passing through 3 vertices, we have a couple of different possibilities. Give each vertex/asterix numbers like:
1 2 3
4 5 6
7 8 9 

If we place the longest side of the triangle along the edge of the grid, e.g. passing through the vertices $1, 2$ and $3$, we have $4$ different possibilities when choosing the third corner (I'm ignoring vertices $7$ and $9$ here, since these triangles would be counted several times otherwise). There are $4$ such edges giving us $16$ possible triangles.
If we place the longest side along the horizontal axis, we can choose $6$ different vertices. The same applies for the vertical axis, which gives us an additional $12$ triangles.
Finally, the longest side, can be placed on a diagonal axis (e.g. through $1,5,9$) where we have $6$ possible choices (notice that we get the triangles we ignored in the first case), and there are $2$ such diagonal axes. We therefore have another $12$ possible triangles.
In total we have: $16+12+12=40$ possible configurations.
