Skip to content
Combinatorics · Chapter 7

Geometric Counting

Count triangles, rectangles, squares, paths and polyhedron edges without listing them: choose the lines or points that define each shape, then let combinations and Euler's formula do the work.

You'll need
open on YouTube
7.10%

Triangle Counting

In this section you will be able to count triangles by choosing their 3 corners, and subtract the choices that fall on one line.

How many triangles can you draw using the corners of a stop sign? Listing them by shape is slow. There is a one-line answer.

A triangle is set by its 3 corners. So counting triangles means counting groups of 3 points. That’s a combination.

The catch: 3 points on one line make no triangle. Count every group of 3, then subtract the collinear ones. The same trick works for any shape: ask what defines it, then choose those pieces.

Exploreplay first, formulas later

8 points in a regular 8-gon: C(8, 3) = 56 triangles

sides8

Pick 3 more points. You have found 0 different triangles.

56 groups of 3 = 56 triangles

Pick 3 more points. 56 triangles in all. You found 0.

Watch itpredict, then reveal

Example 7.1

How many triangles can be formed by connecting vertices in a regular octagon?

Triangles from points (its total is revealed at the end of the example)

sides8

Pick 3 more points. You have found 0 different triangles.

Count hidden: predict it first

Pick 3 more points. Count hidden. You found 0.

  1. 1

    You could do casework on the type of triangle, but there is a much slicker way. How many vertices define a triangle?

    Predict first:

Example 7.2

AMC 10

Eight points are chosen on a circle, and chords are drawn connecting every pair of points. No three chords intersect in a single point inside the circle. How many triangles with all three vertices in the interior of the circle are created?

Triangles from points (its total is revealed at the end of the example)

points8

Their 3 long chords cross in an interior triangle! You have tried 1 different groups of 6.

Count hidden: predict it first

Their 3 long chords cross in an interior triangle! Count hidden. You found 1.

  1. 1

    Look at one triangle inside the circle. Each side lies along a chord. How many chords does the triangle use?

    Predict first:

Example 7.3

AMC 10

How many triangles with positive area have all their vertices at points (i,j)(i, j) in the coordinate plane, where ii and jj are integers between 11 and 55, inclusive?

Triangles from points (its total is revealed at the end of the example)

rows5
columns5

Pick 3 more points. You have found 0 different triangles.

Count hidden: predict it first

Pick 3 more points. Count hidden. You found 0.

  1. 1

    There are 5×5=255 \times 5 = 25 points. How many ways can you pick 3 of them?

    Predict first:

Contest cornerreal contest problems

Problem 7.6.1

AMC 10

A set of 25 square blocks is arranged into a 5×55 \times 5 square. How many different combinations of 3 blocks can be selected from that set so that no two are in the same row or column?

Problem 7.6.2

AMC

From a regular octagon, a triangle is formed by connecting three randomly chosen vertices of the octagon. What is the probability that at least one of the sides of the triangle is also a side of the octagon?

Checkpoint for section 7.1

Get 2 of 3 right to master this section. One try each, no hints.
1

How many triangles can be formed by connecting vertices of a regular hexagon?

2

How many triangles with positive area have all three vertices among the 9 points of a 3×33 \times 3 grid of dots?

3

Ten points lie on a circle and every chord between them is drawn. No three chords meet at one point inside the circle. How many crossing points are inside the circle?

7.20%

Rectangle Counting

In this section you will be able to count every rectangle in a grid by choosing 2 horizontal and 2 vertical lines.

A 3×53 \times 5 grid has 15 small rectangles. How many rectangles of all sizes are hiding in it? Guess before you scroll.

Four corner points don’t always make a rectangle. But two horizontal lines and two vertical lines always do, and every rectangle comes from exactly one such choice. So you count pairs of lines, not shapes.

Exploreplay first, formulas later

3 × 5 grid: C(4, 2) × C(6, 2) = 90 rectangles

rows3
columns5

Pick 2 more horizontal and 2 more vertical lines.

6 × 15 = 90 rectangles

Pick 2 more horizontal and 2 more vertical lines. 90 rectangles in all.

Name it

Theorem 7.2.1 · Rectangles in a Grid

The number of rectangles of all sizes in a rectangular grid of size m×nm \times n is

(m+12)×(n+12).\binom{m+1}{2} \times \binom{n+1}{2}.

Watch itpredict, then reveal

Example 7.4

How many rectangles are in a 3×53 \times 5 grid of rectangles?

Rectangles in a grid (its total is revealed at the end of the example)

rows3
columns5

Pick 2 more horizontal and 2 more vertical lines.

Count hidden: predict it first

Pick 2 more horizontal and 2 more vertical lines. Count hidden.

  1. 1

    Tedious casework would work, but there is a slick solution. What defines a rectangle in a grid?

    Predict first:
    Click a choice or type its letter (A–E).

Checkpoint for section 7.2

Get 2 of 3 right to master this section. One try each, no hints.
1

How many rectangles are in a 2×42 \times 4 grid of squares?

2

How many rectangles of all sizes are on a 6×66 \times 6 grid of squares?

3

In a 3×33 \times 3 grid of squares, how many rectangles contain the center square?

7.30%

Square Counting

In this section you will be able to count squares size by size, including tilted squares and squares that must cover a given cell.

A chessboard has 64 small squares. How many squares does it have in total? Much more than 64.

Squares don’t come from free choices of lines: the sides must match. So go size by size. A k×kk \times k square slides into a row of nn cells in n−k+1n - k + 1 positions, so it fits in (n−k+1)2(n - k + 1)^2 places in an n×nn \times n grid.

Look: squares can also be tilted. A side from one dot to another that goes 1 across and 2 up has length 5\sqrt5.

Exploreplay first, formulas later

4 × 4 grid: 16 squares of size 1 × 1; 30 squares of all sizes

rows4
columns4
square size1
Squares of each size
sizehow manyrunning total
1 × 14 × 4 = 1616
2 × 23 × 3 = 925
3 × 32 × 2 = 429
4 × 41 × 1 = 130
16 + 9 + 4 + 1 = 30 squares

Size 1 × 1: 16 placements, showing number 1. 30 squares of all sizes.

Name it

Theorem 7.3.1 · Squares in a Grid

The number of squares in an n×nn \times n grid of squares is

12+22+⋯+n2=n(n+1)(2n+1)6.1^2 + 2^2 + \cdots + n^2 = \frac{n(n+1)(2n+1)}{6}.

Watch itpredict, then reveal

Example 7.5

How many squares of all sizes can be formed from a 4×44 \times 4 grid of unit squares?

Squares in a grid (its total is revealed at the end of the example)

rows4
columns4
square size1
Squares of each size
sizehow manyrunning total
1 × 1??
2 × 2??
3 × 3??
4 × 4??
Count hidden: predict it first

Size 1 × 1: 16 placements, showing number 1. 30 squares of all sizes.

  1. 1

    There are 16 unit squares. Is the answer 16?

    Predict first:
    Click a choice or type its letter (A–E).

Example 7.6

Omega Learn

How many rectangles, which are not squares, are in a 5×45 \times 4 grid of squares?

Rectangles in a grid (its total is revealed at the end of the example)

rows4
columns5

Pick 2 more horizontal and 2 more vertical lines.

Count hidden: predict it first

Pick 2 more horizontal and 2 more vertical lines. Count hidden.

  1. 1

    Squares are rectangles too, so count all rectangles first. The grid has 6 vertical and 5 horizontal lines. How many rectangles?

    Predict first:
open on YouTube

Example 7.7

Omega Learn

How many squares with side length 5\sqrt{5} can be found in a 55 by 55 grid of points?

Squares in a grid (its total is revealed at the end of the example)

across a1
up b2

Each side goes 1 across and 2 up, so it fits in a box 1 + 2 = 3 wide.

Count hidden: predict it first

Side vector (1, 2), side √5: count hidden, showing number 1.

  1. 1

    Can a side of length 5\sqrt5 be horizontal?

    Predict first:
    Click a choice or type its letter (A–E).
open on YouTube

Example 7.8

AMC 10

The 5×55 \times 5 grid shown contains a collection of squares with sizes from 1×11 \times 1 to 5×55 \times 5. How many of these squares contain the black center square?

Squares in a grid (its total is revealed at the end of the example)

rows5
columns5
square size1
Squares of each size
sizehow manyrunning total
1 × 1??
2 × 2??
3 × 3??
4 × 4??
5 × 5??
Count hidden: predict it first

Size 1 × 1: count hidden.

  1. 1

    Count by size again. How many 1×11 \times 1 squares contain the black square?

    Predict first:
open on YouTube

Example 7.9

Modified AMC 10

How many rectangles formed by the gridlines in this 5×55 \times 5 grid contain the black center square?

Rectangles in a grid (its total is revealed at the end of the example)

rows5
columns5

Pick 2 more horizontal and 2 more vertical lines.

Count hidden: predict it first

Pick 2 more horizontal and 2 more vertical lines. Count hidden.

  1. 1

    A rectangle is fixed by its top, bottom, left and right gridlines. For the rectangle to contain the black square, where must its top line be?

    Predict first:
open on YouTube

Example 7.10

AMC 10

As shown in the figure below, a regular dodecahedron (the polyhedron consisting of 12 congruent regular pentagonal faces) floats in space with two horizontal faces. Note that there is a ring of five slanted faces adjacent to the top face, and a ring of five slanted faces adjacent to the bottom face. How many ways are there to move from the top face to the bottom face via a sequence of adjacent faces so that each face is visited at most once and moves are not permitted from the bottom ring to the top ring?

Polyhedron counter (its total is revealed at the end of the example)

Highlight
turn30°
tilt15°

Dodecahedron · Colors: top face, top ring, bottom ring, bottom face.

Drag the solid (or use turn and tilt) to look at the back.

faces F12
vertices V20
edges E30
  • faces F: 12 pentagons
  • vertices V: 20 vertices with 3 edges
  • Add up the sides of every face: 12·5 = 60 = 2 × 30
  • Add up the edges at every vertex: 20·3 = 60 = 2 × 30
V − E + F = 20 − 30 + 12 = 2

Dodecahedron: F = 12 (12 pentagons), V = 20, E = 30; F + V − 2 = 30

  1. 1

    Your first move goes from the top face into the top ring. How many choices?

    Predict first:
open on YouTube

Contest cornerreal contest problems

Problem 7.6.4

AMC 10

How many ways are there to place 3 indistinguishable red chips, 3 indistinguishable blue chips, and 3 indistinguishable green chips in the squares of a 3×33 \times 3 grid so that no two chips of the same color are directly adjacent to each other, either vertically or horizontally?

Checkpoint for section 7.3

Get 2 of 3 right to master this section. One try each, no hints.
1

How many squares of all sizes are in a 5×55 \times 5 grid of unit squares?

2

How many squares of all sizes are in a 3×43 \times 4 grid of unit squares?

3

How many squares with side length 2\sqrt{2} have all four vertices in a 44 by 44 grid of points?

7.40%

Path Counting

In this section you will be able to count shortest grid paths as words of R's and U's, and handle blocked points, pens and colorings.

A rabbit at (0,0)(0, 0) wants the carrot at (5,5)(5, 5). It only hops right or up. How many different routes can it take?

Write each route as a word: R for a right hop, U for an up hop. Every route is a 10-letter word with five R’s and five U’s, and every such word is a route. So counting routes is counting word rearrangements.

When the rules get stranger (blocked spots, moves down, colored cells), look for what really decides the route. Then count those choices.

Exploreplay first, formulas later

5 right and 5 up: C(10, 5) = 252 paths

right steps5
up steps5
Rabbit (0, 0)Carrot (5, 5)

Path so far: (empty). Press Right or Up.

You have drawn 0 different complete paths.

252 paths

Path so far: (empty). Press Right or Up. 252 paths in all. You have drawn 0 different complete paths.

Name it

Theorem 7.4.1 · Lattice Paths

The number of ways to get from (0,0)(0,0) to a point (m,n)(m,n) moving only up and right is

(m+nm).\binom{m+n}{m}.

Watch itpredict, then reveal

Example 7.11

A rabbit is walking in a coordinate plane and has to get from (0,0)(0,0) to the carrot at the point (5,5)(5,5). If the rabbit can only move 1 unit up or 1 unit right on any given move, how many ways are there for the rabbit to get to the carrot?

Lattice paths (its total is revealed at the end of the example)

right steps5
up steps5
Rabbit (0, 0)Carrot (5, 5)

Path so far: (empty). Press Right or Up.

You have drawn 0 different complete paths.

Turn on Pascal fill to see the count

Path so far: (empty). Press Right or Up. Count hidden. You have drawn 0 different complete paths.

  1. 1

    Casework would be tedious. Write R for a right move and U for an up move. How many right moves does the rabbit need?

    Predict first:

Example 7.12

How many ways to go from (0,0)(0, 0) to (5,6)(5, 6) moving only right or up if you cannot visit all of (1,2)(1, 2), (3,4)(3, 4), and (5,5)(5, 5) because there is a monster that will eat you if you visit all 3 locations?

Lattice paths (its total is revealed at the end of the example)

right steps5
up steps6
Start (0, 0)Goal (5, 6)

You reached Goal, but you visited every monster spot: eaten!

Red dots = Monster spot.

You have drawn 0 different complete paths.

Turn on Pascal fill to see the count

You reached Goal, but you visited every monster spot: eaten! Count hidden. You have drawn 0 different complete paths.

  1. 1

    Ignore the monster for now. How many right/up paths go from (0,0)(0,0) to (5,6)(5,6)?

    Predict first:
open on YouTube

Example 7.13

BMMT

Sally is inside a pen consisting of points (a,b)(a, b) such that 0≤a≤b≤40 \le a \le b \le 4. If she is currently on the point (x,y)(x, y), she can move to either (x,y+1)(x, y + 1), (x,y−1)(x, y - 1), or (x+1,y)(x + 1, y). Given that she cannot revisit any point she has visited before, find the number of ways she can reach (4,4)(4, 4) from (0,0)(0, 0).

Lattice paths (its total is revealed at the end of the example)

pen size4
Sally (0, 0)(4, 4)

Path so far: (empty). Press Up, Down or Right.

In each column you only go straight up or down, then step right. So a route is a choice of where to leave each column.

You have drawn 0 different complete paths.

Count hidden: predict it first

Path so far: (empty). Press Up, Down or Right. Count hidden. You have drawn 0 different routes.

  1. 1

    Sally can never move left. Once she steps right into a new column, can she ever come back to the old one?

    Predict first:
    Click a choice or type its letter (A–E).
open on YouTube

Example 7.14

AMC 8

A game board consists of 64 squares that alternate in color between black and white. The figure below shows square PP in the bottom row and square QQ in the top row. A marker is placed at PP. A step consists of moving the marker onto one of the adjoining white squares in the row above. How many 7-step paths are there from PP to QQ? (The figure shows a sample path.)

Lattice paths (its total is revealed at the end of the example)

PQ

Step 6 of 7. Move up-left or up-right.

Turn on Pascal fill to count every path

Step 6 of 7. Move up-left or up-right. 28 paths from P to Q.

  1. 1

    Each step moves up one row onto a white square diagonally above. How many ways can the marker reach a given white square?

    Predict first:
    Click a choice or type its letter (A–E).
open on YouTube

Example 7.15

HMMT

The cells of a 5×55 \times 5 grid are each colored red, white, or blue. Sam starts at the bottom-left cell of the grid and walks to the top-right cell by taking steps one cell either up or to the right. Thus, he passes through 9 cells on his path, including the start and end cells. Compute the number of colorings for which Sam is guaranteed to pass through a total of exactly 3 red cells, exactly 3 white cells, and exactly 3 blue cells no matter which route he takes.

Lattice paths (its total is revealed at the end of the example)

So far: 1 red, 0 white, 0 blue.

Every route sees the same colors: 3/3/3 (red/white/blue).

Count hidden: predict it first

So far: 1 red, 0 white, 0 blue. Every route sees the same colors: 3/3/3 (red/white/blue).

  1. 1

    How must the grid be colored so that the condition is satisfied?

Checkpoint for section 7.4

Get 2 of 3 right to master this section. One try each, no hints.
1

How many up/right lattice paths go from (0,0)(0,0) to (4,3)(4,3)?

2

How many up/right lattice paths from (0,0)(0,0) to (4,4)(4,4) pass through (2,2)(2,2)?

3

How many up/right lattice paths from (0,0)(0,0) to (3,3)(3,3) avoid the point (1,1)(1,1)?

7.50%

Polyhedrons

In this section you will be able to count faces, edges and vertices of a polyhedron by counting everything twice and using Euler's formula.

A cube has 6 faces and 8 corners. Saw off every corner. How many edges does the new solid have?

You can’t see the back of a solid, so don’t count edges one by one. Count them twice: once from the faces, once from the vertices. Every edge borders 2 faces and joins 2 vertices.

Then one formula ties the three numbers together. Look: for every convex polyhedron, V−E+F=2V - E + F = 2.

Exploreplay first, formulas later

Cube: F = 6 (6 quadrilaterals), V = 8, E = 12; F + V − 2 = 12

Highlight
turn30°
tilt15°

Cube · Colors: faces with the same number of sides.

Drag the solid (or use turn and tilt) to look at the back.

faces F6
vertices V8
edges E12
  • faces F: 6 quadrilaterals
  • vertices V: 8 vertices with 3 edges
  • Add up the sides of every face: 6·4 = 24 = 2 × 12
  • Add up the edges at every vertex: 8·3 = 24 = 2 × 12
V − E + F = 8 − 12 + 6 = 2

Cube: F = 6 (6 quadrilaterals), V = 8, E = 12; F + V − 2 = 12

Name it

Concept 7.5.1 · Counting Edges Twice

In a polyhedron, if you add up the number of sides on every face, you get 2 times the number of edges of the polyhedron. This is because each edge is part of 2 faces.

If you add up the number of edges connected to every vertex, you also get 2 times the number of edges, since each edge is counted at 2 different vertices.

For example, a cube has 4 sides per face and 6 faces, so it has 4×62=12\frac{4 \times 6}{2} = 12 edges. Also, there are 3 edges per vertex and 8 vertices, so there are 3×82=12\frac{3 \times 8}{2} = 12 edges.

Theorem 7.5.2 · Euler's Polyhedron Formula

Edges=Faces+Vertices−2\text{Edges} = \text{Faces} + \text{Vertices} - 2
E=F+V−2E = F + V - 2

Remark 7.5.4

A classic application: if a polyhedron has 12 hexagonal faces and 10 pentagonal faces, how many vertices does it have? Find the number of faces (2222) and the number of edges,

12×6+10×52=61\frac{12 \times 6 + 10 \times 5}{2} = 61

(we divide by 2 since each edge is part of 2 faces). Finally, apply Euler's Polyhedron Formula: V=E−F+2=61−22+2=41V = E - F + 2 = 61 - 22 + 2 = 41.

(A sharp eye: every vertex needs at least 3 edges, so 2E≥3V2E \ge 3V. Here 122<123122 < 123, so no real polyhedron has exactly these faces. The method is what matters; a soccer ball, with 20 hexagons and 12 pentagons, works.)

Watch itpredict, then reveal

Example 7.16

AMC 12

A convex polyhedron QQ has vertices V1,V2,…,VnV_1, V_2, \ldots, V_n, and 100100 edges. The polyhedron is cut by planes P1,P2,…,PnP_1, P_2, \ldots, P_n in such a way that plane PkP_k cuts only those edges that meet at vertex VkV_k. In addition, no two planes intersect inside or on QQ. The cuts produce nn pyramids and a new polyhedron RR. How many edges does RR have?

Polyhedron counter (its total is revealed at the end of the example)

Highlight
turn30°
tilt15°

Cube · Colors: faces with the same number of sides.

Drag the solid (or use turn and tilt) to look at the back.

faces F6
vertices V8
edges E12
  • faces F: 6 quadrilaterals
  • vertices V: 8 vertices with 3 edges
  • Add up the sides of every face: 6·4 = 24 = 2 × 12
  • Add up the edges at every vertex: 8·3 = 24 = 2 × 12
V − E + F = 8 − 12 + 6 = 2

Cube: F = 6 (6 quadrilaterals), V = 8, E = 12; F + V − 2 = 12

  1. 1

    Essentially, we are cutting off every corner of the polyhedron (try Cut every corner on the cube). According to Euler's Polyhedron Formula, how many faces did the original polyhedron have?

    Predict first:

Contest cornerreal contest problems

Problem 7.6.3

AMC 10

A rhombic dodecahedron is a convex polyhedron where each of the 12 faces is a rhombus, and all of the faces are congruent to each other. The number of edges that meet at a vertex is either 3 or 4, depending on the vertex. What is the number of vertices at which exactly 3 edges meet?

Problem 7.6.5

AMC 12Challenge

Each face of a regular tetrahedron is painted either red, white, or blue. Two colorings are considered indistinguishable if two congruent tetrahedra with those colorings can be rotated so that their appearances are identical. How many distinguishable colorings are possible?

Tetrahedron (counts hidden)

Highlight
turn30°
tilt15°

Tetrahedron

Drag the solid (or use turn and tilt) to look at the back.

Counts hidden: count them yourself first

Tetrahedron (counts hidden)

Problem 7.6.6

AMC 10/12

If AA and BB are vertices of a polyhedron, define the distance d(A,B)d(A, B) to be the minimum number of edges of the polyhedron one must traverse in order to connect AA and BB. For example, if AB‾\overline{AB} is an edge of the polyhedron, then d(A,B)=1d(A, B) = 1, but if AC‾\overline{AC} and CB‾\overline{CB} are edges and AB‾\overline{AB} is not an edge, then d(A,B)=2d(A, B) = 2. Let QQ, RR, and SS be randomly chosen distinct vertices of a regular icosahedron (regular polyhedron made up of 20 equilateral triangles). What is the probability that d(Q,R)>d(R,S)d(Q, R) > d(R, S)?

Checkpoint for section 7.5

Get 2 of 3 right to master this section. One try each, no hints.
1

An octahedron has 8 triangular faces. How many edges does it have?

2

A convex polyhedron has 6 vertices and 12 edges. How many faces does it have?

3

A soccer ball is a polyhedron with 12 pentagons and 20 hexagons. How many edges does it have?

7.6

Practice Problems

In this section you will be able to mix every tool from this chapter on two harder contest problems.

Two harder counting problems where symmetry does the heavy lifting. Each has three hints if you get stuck.

Want every problem from this chapter on one page? Open the problem set.

Contest cornerreal contest problems

Problem 7.6.7(additional)

AIME

There is an unlimited supply of congruent equilateral triangles made of colored paper. Each triangle is a solid color with the same color on both sides of the paper. A large equilateral triangle is constructed from four of these paper triangles. Two large triangles are considered distinguishable if it is not possible to place one on the other, using translations, rotations, and/or reflections, so that their corresponding small triangles are of the same color.

Given that there are six different colors of triangles from which to choose, how many distinguishable large equilateral triangles may be formed?

Problem 7.6.8(additional)

AMC 10Challenge

Square ABCDABCD in the coordinate plane has vertices at the points A(1,1)A(1, 1), B(−1,1)B(-1, 1), C(−1,−1)C(-1, -1), and D(1,−1)D(1, -1). Consider the following four transformations:

  • LL, a rotation of 90∘90^\circ counterclockwise around the origin;
  • RR, a rotation of 90∘90^\circ clockwise around the origin;
  • HH, a reflection across the xx-axis; and
  • VV, a reflection across the yy-axis.

Each of these transformations maps the square onto itself, but the positions of the labeled vertices will change. For example, applying RR and then VV would send the vertex AA at (1,1)(1, 1) to (−1,−1)(-1, -1) and would send the vertex BB at (−1,1)(-1, 1) to itself. How many sequences of 2020 transformations chosen from {L,R,H,V}\{L, R, H, V\} will send all of the labeled vertices back to their original positions? (For example, R,R,V,HR, R, V, H is one sequence of 44 transformations that will send the vertices back to their original positions.)