# 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.

• What does "at least one of their sides passes from 3 vertices" mean? Do all the corners have to come from the grid? What is the additional restriction? – Ross Millikan Feb 3 '14 at 15:09
• Is this more clear? – Veritas Feb 3 '14 at 15:17
• Is this a $3 \times 3$ grid or a $9 \times 9$ grid? You have 9 asterisks – qwr Feb 3 '14 at 16:55
• Wow so many hours passed and I've just realized I wrote 9x9. – Veritas Feb 3 '14 at 16:58

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}$$

• The problem is that they don't just have to triangles but one of their sides must also pass from 3 vertices. – Veritas Feb 3 '14 at 14:16
• Well since we are choosing the triangles as 3 points from the 9 point set isn't that always the case? – Veritas Feb 3 '14 at 14:21
• is the new answer correct? – Shaurya Gupta Feb 3 '14 at 14:30
• I wouldn't ask if I knew :/ By the way could you explain the last observation in detail ? – Veritas Feb 3 '14 at 14:48

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?

• The problem is that every triangle must also have a side that passes from 3 asterisks. – Veritas Feb 3 '14 at 15:36

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.