A railway passes through four towns A , B , C , and D . The railway forms a complete loop, as shown below, and trains go in both directions. Suppose that a trip between two adjacent towns costs one ticket. Using exactly eight tickets, how many distinct ways are there of traveling from town A and ending at town A ? ( Note that passing through A somewhere in the middle of the trip is allowed. )
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.
The adjacency matrix of the graph is
M = ⎝ ⎜ ⎜ ⎛ 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 ⎠ ⎟ ⎟ ⎞ ,
if the rows and columns are ordered A , B , C , D . Each entry in M n is the number of paths of length exactly n between the vertices corresponding to its row and column. By direct computation,
M 8 = ⎝ ⎜ ⎜ ⎛ 1 2 8 0 1 2 8 0 0 1 2 8 0 1 2 8 1 2 8 0 1 2 8 0 0 1 2 8 0 1 2 8 ⎠ ⎟ ⎟ ⎞ ,
so the number of paths of length 8 from A to A is the top left entry, 128.
Let us f ( n ) Now you n = 1 ∑ 8 f ( n ) Let ‘ a’ a + b a − b ⟹ a − b ⟹ ( a , b ) The T ways define a function f ( n ) such that, = { 1 − 1 : if the nth ticket was used to move in the clockwise direction : if the nth ticket was used to move in the anti-clockwise direction can start and end the journey at A if , ≡ 0 ( m o d 4 ) ( 1 ) denote the number of 1 ’s and ‘ b’ denote the number of − 1 ’s. = 8 The total number of tickets ≡ 0 ( m o d 4 ) From ( 1 ) , − 8 ≤ ( a − b ) ≤ 8 = 0 , 4 , − 4 , 8 , − 8 = ( 4 , 4 ) , ( 6 , 2 ) , ( 2 , 6 ) , ( 8 , 0 ) , ( 0 , 8 ) number of ways, of permuting ‘ a’ 1’s and ‘ b’ -1’s over 8 spaces is a ! b ! 8 ! = ( a , b ) ∑ a ! b ! 8 ! = 4 ! 4 ! 8 ! + 6 ! 2 ! 8 ! + + 2 ! 6 ! 8 ! + 8 ! 0 ! 8 ! + 0 ! 8 ! 8 ! = 7 0 + 2 8 + 2 8 + 1 + 1 = 1 2 8
A > [B/D] > [A/C] > [B/D] > [A/C] > [B/D] > [A/C] > [B/D] > A
2 * 2 * 2 * 2 * 2 * 2 * 2 * 1 = 2^7 = 128
There are 2 choices in each of 7 middle cases, for going from A to A by using 8 tickets, and in last case, one must have to return in A. So, there is one choice, and hence the problem is done.
Problem Loading...
Note Loading...
Set Loading...
Knowing that you have to make exactly 8 moves, you will never end at B or D.
Half of the time you will end up at A and the other half of the time you will end at C.
Since we have 2 directions to go and 8 moves to make we have 2^8 = 256 total paths.
We said earlier we expect half of those end us back at A, so our answer should be 128.