Counting triangles in a grid, step by step

A grid of dots, and one question: how many triangles have three of the dots as corners?

The question
A geoboard has its pegs in a rectangle 2 pegs across and 5 pegs down — 10 pegs altogether. A triangle is any three pegs joined by rubber bands.How many triangles can be made?Why

How many triangles can be made?

Count the triangles without drawing them

across:2 down:5 pegs:10
1×10=10
10÷1=10
10×9=90
90÷2=45
45×8=360
360÷3=120
in a line:20
12020=100
  1. Start from the pegs: 2 across and 5 down, 10 in all. A triangle is any three of them as corners, and drawing them all is what this walk avoids.
  2. Choosing 3 of the 10 pegs is 10 choose 3, C(10,3) = 120, one factor at a time.
  3. But three pegs in a straight line make no triangle. Here that is 20 down the columns — 20 straight-line triples in all.
  4. Take them off: 120 − 20 = 100. So 100 triangles, not the 120 you get by forgetting the straight lines.

How it works.

  1. 01

    Start from the pegs: 2 across and 5 down, 10 in all. A triangle is any three of them as corners, and drawing them all is what this walk avoids.

  2. 02

    Choosing 3 of the 10 pegs is 10 choose 3, C(10,3) = 120, one factor at a time.

  3. 03

    But three pegs in a straight line make no triangle. Here that is 20 down the columns — 20 straight-line triples in all.

  4. 04

    Take them off: 120 − 20 = 100. So 100 triangles, not the 120 you get by forgetting the straight lines.