The diagram above shows a map.
Find the total amount of shortest paths from to .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
1st method: Combinatorics method.
Firstly, let's mark the map and fill in the spaces. The formula to calculate all the possible paths from A to B without excluding the obstacles is ( m + n n ) for a m × n grid. ( 8 + 8 8 ) = 1 2 8 7 0
Then, we need to calculate the number of paths that pass through the obstacles. The formula to find out the number of paths passing through a point in a m × n grid is ( a + b b ) ( ( m + n ) − ( a + b ) n − b ) given that a and b are the coordinates of the point.
The number of paths that pass through obstacles a and e = ( 2 + 2 2 ) ( ( 8 + 8 ) − ( 2 + 2 ) 8 − 2 ) = 5 5 4 4
The number of paths that pass through obstacles b and d = ( 2 + 6 6 ) ( ( 8 + 8 ) − ( 2 + 6 ) 8 − 6 ) = 7 8 4
The number of paths that pass through obstacles c = ( 4 + 4 4 ) ( ( 8 + 8 ) − ( 4 + 4 ) 8 − 4 ) = 4 9 0 0
Next, we need to find out the number of overlapping paths between the obstacles. We will be using the same concept.
Overlapping paths between obstacles a and b , a and d , b and e , d and e = ( 2 + 2 2 ) ( ( 2 + 6 ) − ( 2 + 2 ) 6 − 2 ) ( ( 8 + 8 ) − ( 2 + 6 ) 8 − 6 ) = 1 6 8
Overlapping paths between obstacles a and c , a and e , c and e = ( 2 + 2 2 ) ( ( 4 + 4 ) − ( 2 + 2 ) 4 − 2 ) ( ( 8 + 8 ) − ( 4 + 4 ) 8 − 4 ) = 2 5 2 0
After that, we will find out the number of overlapping paths in the overlapping paths between the obstacles.
Overlapping paths in the overlapping paths between the obstacles a , b , e and a , d , e = ( 2 + 2 2 ) ( ( 2 + 6 ) − ( 2 + 2 ) 6 − 2 ) ( ( 6 + 6 ) − ( 2 + 6 ) 6 − 6 ) ( ( 8 + 8 ) − ( 6 + 6 ) 8 − 6 ) = 3 6
Overlapping paths in the overlapping paths between the obstacles a , c , e = ( 2 + 2 2 ) ( ( 4 + 4 ) − ( 2 + 2 ) 4 − 2 ) ( ( 6 + 6 ) − ( 4 + 4 ) 6 − 4 ) ( ( 8 + 8 ) − ( 6 + 6 ) 8 − 6 ) = 1 2 9 6
Finally, sum up the numbers.
All paths from A to B
= Total number of possible paths from A to B without excluding the obstacles − Total number of paths that pass through the obstacles + Total number of overlapping paths between the obstacles − Total number of overlapping paths in the overlapping paths between the obstacles
= 1 2 8 7 0 − ( 5 5 4 4 × 2 + 7 8 4 × 2 + 4 9 0 0 ) + ( 1 6 8 × 4 + 2 5 2 0 × 3 ) − ( 3 6 × 2 + 1 2 9 6 ) = 2 1 7 8
Note: Some steps have been removed to prevent repetition.
2nd method: Trick method.
Just line up the top side and left side of the map with 1 's and add up the numbers on the diagonals. Refer to the diagram below.