Paths

The diagram above shows a map.

Find the total amount of shortest paths from A A to B B .


The answer is 2178.

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.

1 solution

Lee Care Gene
Jun 13, 2016

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 A to B B without excluding the obstacles is ( m + n n ) \begin{pmatrix} m+n \\ n \end{pmatrix} for a m × n m\times n grid. ( 8 + 8 8 ) = 12870 \begin{pmatrix} 8+8 \\ 8 \end{pmatrix}=12870

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 m\times n\ grid is ( a + b b ) ( ( m + n ) ( a + b ) n b ) \begin{pmatrix} a+b \\ b \end{pmatrix}\begin{pmatrix} \left( m+n \right) -\left( a+b \right) \\ n-b \end{pmatrix} given that a a and b b are the coordinates of the point.

The number of paths that pass through obstacles a a and e = ( 2 + 2 2 ) ( ( 8 + 8 ) ( 2 + 2 ) 8 2 ) = 5544 e=\begin{pmatrix} 2+2 \\ 2 \end{pmatrix}\begin{pmatrix} \left( 8+8 \right) -\left( 2+2 \right) \\ 8-2 \end{pmatrix}=5544\\

The number of paths that pass through obstacles b b and d = ( 2 + 6 6 ) ( ( 8 + 8 ) ( 2 + 6 ) 8 6 ) = 784 d=\begin{pmatrix} 2+6 \\ 6 \end{pmatrix}\begin{pmatrix} \left( 8+8 \right) -\left( 2+6 \right) \\ 8-6 \end{pmatrix}=784\\

The number of paths that pass through obstacles c = ( 4 + 4 4 ) ( ( 8 + 8 ) ( 4 + 4 ) 8 4 ) = 4900 c=\begin{pmatrix} 4+4 \\ 4 \end{pmatrix}\begin{pmatrix} \left( 8+8 \right) -\left( 4+4 \right) \\ 8-4 \end{pmatrix}=4900\\

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 a and b b , a a and d d , b b and e e , d d and e e = ( 2 + 2 2 ) ( ( 2 + 6 ) ( 2 + 2 ) 6 2 ) ( ( 8 + 8 ) ( 2 + 6 ) 8 6 ) = 168 =\begin{pmatrix} 2+2 \\ 2 \end{pmatrix}\begin{pmatrix} \left( 2+6 \right) -\left( 2+2 \right) \\ 6-2 \end{pmatrix}\begin{pmatrix} \left( 8+8 \right) -\left( 2+6 \right) \\ 8-6 \end{pmatrix}=168\\

Overlapping paths between obstacles a a and c c , a a and e e , c c and e e = ( 2 + 2 2 ) ( ( 4 + 4 ) ( 2 + 2 ) 4 2 ) ( ( 8 + 8 ) ( 4 + 4 ) 8 4 ) = 2520 =\begin{pmatrix} 2+2 \\ 2 \end{pmatrix}\begin{pmatrix} \left( 4+4 \right) -\left( 2+2 \right) \\ 4-2 \end{pmatrix}\begin{pmatrix} \left( 8+8 \right) -\left( 4+4 \right) \\ 8-4 \end{pmatrix}=2520\\

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 a , b b , e e and a a , d d , e e = ( 2 + 2 2 ) ( ( 2 + 6 ) ( 2 + 2 ) 6 2 ) ( ( 6 + 6 ) ( 2 + 6 ) 6 6 ) ( ( 8 + 8 ) ( 6 + 6 ) 8 6 ) = 36 =\begin{pmatrix} 2+2 \\ 2 \end{pmatrix}\begin{pmatrix} \left( 2+6 \right) -\left( 2+2 \right) \\ 6-2 \end{pmatrix}\begin{pmatrix} \left( 6+6 \right) -\left( 2+6 \right) \\ 6-6 \end{pmatrix}\begin{pmatrix} \left( 8+8 \right) -\left( 6+6 \right) \\ 8-6 \end{pmatrix}=36\\

Overlapping paths in the overlapping paths between the obstacles a a , c c , e e = ( 2 + 2 2 ) ( ( 4 + 4 ) ( 2 + 2 ) 4 2 ) ( ( 6 + 6 ) ( 4 + 4 ) 6 4 ) ( ( 8 + 8 ) ( 6 + 6 ) 8 6 ) = 1296 =\begin{pmatrix} 2+2 \\ 2 \end{pmatrix}\begin{pmatrix} \left( 4+4 \right) -\left( 2+2 \right) \\ 4-2 \end{pmatrix}\begin{pmatrix} \left( 6+6 \right) -\left( 4+4 \right) \\ 6-4 \end{pmatrix}\begin{pmatrix} \left( 8+8 \right) -\left( 6+6 \right) \\ 8-6 \end{pmatrix}=1296\\

Finally, sum up the numbers.

All paths from A A to B B

= = Total number of possible paths from A A to B 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

= 12870 ( 5544 × 2 + 784 × 2 + 4900 ) + ( 168 × 4 + 2520 × 3 ) ( 36 × 2 + 1296 ) = 2178 =12870-\left( 5544\times 2+784\times 2+4900 \right) +\left( 168\times 4+2520\times 3 \right) -\left( 36\times 2+1296 \right) \\ =2178

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 1 's and add up the numbers on the diagonals. Refer to the diagram below.

Moderator note:

Great approaches. For the first method, it would be clearer if you explain that you're using the Principle of Inclusion and Exclusion.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...