Railway Station

A railway passes through four towns A A , B B , C C , and D 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 A and ending at town A A ? ( Note that passing through A A somewhere in the middle of the trip is allowed. )


The answer is 128.

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.

4 solutions

Kyle T
Apr 8, 2019

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.

The adjacency matrix of the graph is

M = ( 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 ) , M = \begin{pmatrix} 0 & 1 & 0 & 1\\ 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1\\ 1 & 0 & 1 & 0 \end{pmatrix},

if the rows and columns are ordered A , B , C , D A, B, C, D . Each entry in M n M^n is the number of paths of length exactly n n between the vertices corresponding to its row and column. By direct computation,

M 8 = ( 128 0 128 0 0 128 0 128 128 0 128 0 0 128 0 128 ) , M^8 = \begin{pmatrix} 128 & 0 & 128 & 0\\ 0 & 128 & 0 & 128\\ 128 & 0 & 128 & 0\\ 0 & 128 & 0 & 128\\ \end{pmatrix},

so the number of paths of length 8 from A A to A A is the top left entry, 128.

Let us define a function f ( n ) such that, f ( n ) = { 1 : if the nth ticket was used to move in the clockwise direction 1 : if the nth ticket was used to move in the anti-clockwise direction Now you can start and end the journey at A if , n = 1 8 f ( n ) 0 ( m o d 4 ) ( 1 ) Let a’ denote the number of 1 ’s and b’ denote the number of 1 ’s. a + b = 8 The total number of tickets a b 0 ( m o d 4 ) From ( 1 ) , 8 ( a b ) 8 a b = 0 , 4 , 4 , 8 , 8 ( a , b ) = ( 4 , 4 ) , ( 6 , 2 ) , ( 2 , 6 ) , ( 8 , 0 ) , ( 0 , 8 ) The number of ways, of permuting a’ 1’s and b’ -1’s over 8 spaces is 8 ! a ! b ! T ways = ( a , b ) 8 ! a ! b ! = 8 ! 4 ! 4 ! + 8 ! 6 ! 2 ! + + 8 ! 2 ! 6 ! + 8 ! 8 ! 0 ! + 8 ! 0 ! 8 ! = 70 + 28 + 28 + 1 + 1 = 128 \begin{aligned} \text{Let us}&\text{ define a function } f(n) \text{ such that,}\\ f(n)&={\begin{cases}\hspace{3mm} 1&:\text{if the nth ticket was used to move in the clockwise direction}\\ -1&:\text{if the nth ticket was used to move in the anti-clockwise direction}\\ \end{cases}}\\ \text{Now you}&\text{ can start and end the journey at A if ,}\\ \sum_{n=1}^8 f(n)&\equiv0\pmod{4} \hspace{4mm}\color{#3D99F6}\small(1)\\\\ \text{Let }`\text{a'} &\text{ denote the number of }1\text{'s and }`\text{b'} \text{ denote the number of }-1\text{'s.}\\ a+b&=8 \hspace{4mm}\color{#3D99F6}\small\text{The total number of tickets}\\ a-b&\equiv0\pmod {4} \hspace{4mm}\color{#3D99F6}\small\text{From} (1),-8\leq(a-b)\leq8\\ \implies{a-b}&=0,4,-4,8,-8 \\ \implies(a,b)&=(4,4),(6,2),(2,6),(8,0),(0,8)\\\\ \text{The}&\text{ number of ways, of permuting } `\text{a' 1's and } `\text{b' -1's over 8 spaces is }\dfrac{8!}{a!b!}\\ \text{T}_{\small\text{ways}}&= \sum_{(a,b)} \dfrac{8!}{a!b!}\\ &=\dfrac{8!}{4! 4!}+\dfrac{8!}{6!2!}++\dfrac{8!}{2!6!}+\dfrac{8!}{8!0!}+\dfrac{8!}{0!8!}\\ &=70+28+28+1+1\\ &=\color{#EC7300}\boxed{\color{#333333}128} \end{aligned}

Avik Das
Apr 12, 2019

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.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...