Paths to the playground¶
Counting and combinations · level 1, lesson 5 of 6
A question to start¶
Nia lives on a corner of a town where the streets make neat squares. The playground is 2 blocks to the right and 2 blocks up from her home. Nia always walks the short way: she only ever walks right or up, never left and never down.
How many different ways can Nia walk to the playground? Try to trace them with your finger. Is it 2? 4? More?
The answer is 6, and in this lesson you will find all 6, be sure there are no more, and learn a clever trick that counts the paths without tracing them at all.
The idea¶
What is a path?¶
A path here is a walk along the streets from home to the playground, going only right or up. Two paths are different if they use different streets, even for one block.
Since Nia only goes right or up, every path has the same length. She must go 2 blocks right altogether (to get across) and 2 blocks up altogether (to get up). That is 4 blocks, every time. The only thing that changes from path to path is the order of the blocks.
Write a path as letters¶
Writing "right, right, up, up" takes a long time, so let's write R for one block right and U for one block up. Then the path along the bottom street and up the right-hand side is R R U U.
Every path is 4 letters: two R's and two U's, in some order. And every order of two R's and two U's is a path. So counting paths is the same as counting the ways to write two R's and two U's in a row.
Trace every path, tidily¶
Be organised, the same way as before: sort the paths by their first step.
- Right first. After one R, there is 1 more R and 2 U's to place. The paths are R R U U, R U R U, R U U R.
- Up first. After one U, there are 2 R's and 1 more U to place. The paths are U R R U, U R U R, U U R R.
3 and 3 make 6 paths.
Why there are no more¶
Look at the first group, right first. After the first R, Nia still has to place 1 R and 2 U's. The only question is where the leftover R goes: second, third or last. That gives exactly 3 paths. It is just like lining up 2 red blocks and 1 blue block in the last lesson: the lonely R is the blue block.
The second group, up first, works the same way: the only question is where the leftover U goes. Second, third or last: 3 paths.
Every path starts with R or with U, so every path is in one of the two groups. Nothing is missing, nothing is twice. There are exactly 6.
The corner trick¶
Tracing works for small grids, but it gets slow. Here is a lovely trick. At every corner, write the number of ways Nia can get there from home.
Start at home: write 1 (there is one way to "get" home: don't move).
Now think about any other corner. Nia only walks right or up, so she can only arrive at a corner from the left or from below. Every path to this corner comes in one of those two ways. So:
the number at a corner = the number on its left + the number below it.
Along the bottom street, every corner can only be reached from the left, so each one gets 1: there is only one way, straight along. Up the left-hand street, every corner gets 1 too. Then fill in the rest by adding:
- The middle corner: 1 from the left and 1 from below, so 2.
- The corner to its right: 2 from the left and 1 from below, so 3.
- The corner above the middle: 1 from the left and 2 from below, so 3.
- The playground: 3 from the left and 3 from below, so 6. ✓
The trick and the tracing agree. And notice the two 3's at the end: they are exactly our two groups! The 3 paths that arrive from the left are the ones whose last step is R, and the 3 that arrive from below end with U.
Worked examples¶
1. One block each way. The playground is 1 block right and 1 block up. Paths: R U (along then up) and U R (up then along). 2 paths. Corner trick: home 1, the corners beside and above it 1 each, playground 1 and 1 make 2. ✓
2. Two right, one up. Paths have two R's and one U. Where does the U go? First, second or last: U R R, R U R, R R U. 3 paths. This is the middle row of our corner picture: the 3 is there.
3. Three right, two up. Now tracing is hard work. Use the corner trick. Fill in the bottom row and the left column with 1's, then add:
| 0 right | 1 right | 2 right | 3 right | |
|---|---|---|---|---|
| 2 up | 1 | 3 | 6 | 10 |
| 1 up | 1 | 2 | 3 | 4 |
| 0 up (home's street) | 1 | 1 | 1 | 1 |
Each number is the one on its left plus the one below it. For example, 6 is 3 and 3, and 10 is 6 and 4. There are 10 paths.
4. A street is closed. Back on the 2-by-2 grid, the street from the middle corner going up is closed for repairs. How many paths now?
Use the corner trick, but do not add across the closed street. The corner above the middle can now only be reached from its left: it gets 1 instead of 3. The playground is then 1 (from the left) and 3 (from below), which is 4 paths. Check by tracing: of the 6 paths, the two that go through the middle corner and then up (R U U R and U R U R) are gone, leaving 4. ✓
Try it¶
- The playground is 3 blocks right and 0 blocks up. How many paths?
- The playground is 1 block right and 2 blocks up. List all the paths using R and U.
- Copy the 2-by-2 grid and fill in the corner numbers yourself without looking.
- The playground is 1 block right and 3 blocks up. How many paths?
- The playground is 2 blocks right and 3 blocks up. Use the corner trick. (Hint: turn the table in example 3 on its side.)
- On the 2-by-2 grid, the street along the bottom from home to the first corner is closed. How many paths now?
- On the 3-by-3 grid (3 right, 3 up), how many paths are there? Fill in all the corners.
Answers
- 1 path: R R R, straight along. You cannot go up at all, so there is no choice.
- 3 paths: R U U, U R U, U U R. (Where does the one R go? First, second or last.)
- Bottom row 1, 1, 1; middle row 1, 2, 3; top row 1, 3, 6. The playground gets 6.
- 4 paths: the one R can go first, second, third or last: R U U U, U R U U, U U R U, U U U R. With the corner trick the column next to the 1's reads 1, 2, 3, 4.
- 10 paths. It is the same grid as example 3, just turned on its side (going up instead of across), so the answer is the same.
- The first corner along the bottom could only be reached from home along that street, so now it cannot be reached at all: it gets 0, and so does the corner after it. The bottom row is 1, 0, 0. Middle row: 1, then 1 and 0 make 1, then 1 and 0 make
- Top row: 1, then 1 and 1 make 2, then 2 and 1 make 3. 3 paths: they are exactly the ones that start with U.
- Bottom row 1, 1, 1, 1. Next row 1, 2, 3, 4. Next 1, 3, 6, 10. Top row 1, 4, 10, 20. There are 20 paths.
Common mistake¶
Going backwards. A path that goes left or down is longer and is not allowed here. If your path ever goes left or down, it is not one of the paths we are counting.
Adding the wrong neighbours. In the corner trick, add the number on the left and the number below, not the ones on the right or above. Those corners come after this one, so Nia has not been there yet.
Where it leads¶
- Previous: Handshakes · Next: Being organised, where we collect all the tidy-listing tricks of this level.
- Level 1 page · Counting topic page
- Giving a robot directions on a grid is in Geometry level 1: where is it?
- The numbers in the corners (1, 2, 3, 4 ... 1, 3, 6, 10 ...) are the handshake numbers from the last lesson! In level 5 they become Pascal's triangle. They are a famous pattern too: Patterns.