Counting monotone grid paths through step positions
A shortest path from one corner of a grid to the opposite corner is a sequence of east and north steps. Counting those paths comes down to choosing which positions in the sequence are north steps.
From a picture of a grid to a string of steps
Imagine walking along the lines of a grid from the lower-left corner to a point three blocks east and two blocks north, moving only east or north. Every such walk takes exactly five steps, three of them east (E) and two of them north (N). Writing the steps in order turns each walk into a five-letter string, such as EENEN or NNEEE. Two walks are the same path only when their strings match letter for letter. So counting paths is the same as counting the distinct strings with three E letters and two N letters, which is a question about arrangements rather than about geometry.
Choosing positions with a combination
A string is fixed once you decide which of the five positions hold the N letters. The other positions are filled with E automatically. The number of ways to choose 2 positions out of 5 is the combination C(5, 2) = 5! ÷ (2! × 3!) = 120 ÷ 12 = 10. The order in which you pick the positions does not matter, because picking position 1 then position 4 gives the same string as picking 4 then 1. That is exactly the situation a combination counts. The combination calculator takes n = 5 and r = 2 and returns 10, matching the first worked case below the article.
The same count from the east side
You can also choose the three positions that hold E letters. C(5, 3) = 5! ÷ (3! × 2!) = 10, the same number. This works because choosing which positions are north steps and choosing which are east steps describe one and the same split of the five positions into two groups. In general C(n, r) = C(n, n - r). The symmetry is a useful check on any grid count: if the two choices disagree, one of them has the wrong step total or the wrong number of steps of a kind. The second worked case enters r = 3 and confirms the result is again 10.
Listing all ten paths
Counting is easier to trust once you have seen the list. With two N letters in five positions, the pairs of positions are 12, 13, 14, 15, 23, 24, 25, 34, 35 and 45. Those give the strings NNEEE, NENEE, NEENE, NEEEN, ENNEE, ENENE, ENEEN, EENNE, EENEN and EEENN. There are ten, with no repeats and no missing pairs. Writing the pairs in this orderly way, first position fixed while the second runs forward, is a standard method for listing combinations without duplicates. For larger grids the list becomes too long to write, but the formula keeps working, and a small listing like this one confirms you set it up correctly.
A larger grid
Take a grid four blocks east and three north. Each path has 7 steps, and choosing 3 of them as north steps gives C(7, 3) = 5040 ÷ (6 × 24) = 35 paths. For a square grid with five blocks in each direction, a path has 10 steps and the count is C(10, 5) = 252. A four-by-four grid with 8 steps gives C(8, 4) = 70. These numbers grow fast, which is why it is impractical to count large grids by drawing them. Notice that the total number of steps is the sum of the two side lengths, and the choose-number is either side length. Mixing up the step total with one side is the most common setup mistake.
What counts as an allowed move
The count applies only to monotone paths, those that never go west or south. Allowing backtracking would make the number of paths infinite, since a walker could step back and forth without end. Allowing diagonal moves changes the alphabet of the strings and the counting method. Blocked corners or missing edges require subtracting paths that use them, a technique covered in the guide on avoiding a specified point. If a problem says shortest route on a rectangular street grid, that normally implies east and north steps only, but the statement should say so explicitly when you write up the solution.
Setup errors with step counts
Three setup errors appear repeatedly. The first is to take C(3, 2) or C(2, 3) because the side lengths are 3 and 2, instead of using the total step count of 5. The second is to multiply 3 × 2 = 6, which counts rectangles or unit squares in the grid rather than paths. The third is to use a permutation formula and forget that identical steps cannot be told apart, which would count each path many times over. A quick safeguard is to compute the number of steps first, write down how many are of each kind, and check that the two kinds add up to the total before touching the calculator.
Paths to a point in the middle of the grid
The same choose-the-positions idea gives the number of ways to reach any point, not only the far corner. To reach (2, 1), a walker takes 3 steps with 2 east and 1 north, so there are C(3, 1) = 3 routes. To reach (3, 2) there are C(5, 2) = 10. Writing these counts on each grid point produces Pascal's triangle turned on its side, since the number of routes to a point equals the sum of the routes to the point on its left and the point below it. Along the left and bottom edges each point has exactly one route. Filling the grid this way is a method that needs no formula, and it agrees with every combination used above. It also gives a second check on any result.
Ideal grid paths and real distance
The count describes paths on an ideal grid and nothing about physical distance. Every path in the example has the same length of five blocks, so none is shorter than another. If streets have different lengths, or if some turns are costly, the count of paths says nothing about the best route. The tool is also an integer combination calculator. It requires n and r to be whole numbers with r not larger than n, and very large grids produce counts that grow beyond what a plain display can show exactly. For a classroom-size grid, the output is exact and can be checked by listing. If you need the count for a grid with a rectangular shape, always enter the total number of steps as n and either side length as r.
Reproduce the checks
North-step positions
Open the Combination calculator and enter:
- Total items n
5- Items selected r
2
Expected output:
Combinations
10The other positions are east steps.
East-step positions
Open the Combination calculator and enter:
- Total items n
5- Items selected r
3
Expected output:
Combinations
10The complementary position choice gives the same paths.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.