Feynman Checkerboard!

Richard P Feynman starts his journey from O = ( 0 , 0 ) O=(0,0) towards A = ( 10 , 6 ) . A=(10,6). He can only go in the + x +x and + y +y directions along the lattice, and he must turn exactly 7 times. An example path is shown above, with the yellow dots indicating turns.

How many ways can Feynman travel from O O to A A in this way?


Bonus : Consider the general case, traveling from ( 0 , 0 ) (0,0) to ( p , q ) (p,q) with exactly r r turns.


The answer is 1680.

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.

7 solutions

Andy Hayes
Jun 27, 2017

Since you can only go up or to the right, the turns must be alternating left and right turns.

Now consider that with 7 turns, there will be 4 upward movements and 4 rightward movements. We can establish a bijection between grouping upward movements and grouping stars with bars.

_ _ _ _ _ \star \text{ \_ } \star \text{ \_ } \star \text{ \_ } \star \text{ \_ } \star \text{ \_ } \star

Above, there are 6 stars, and the spaces indicate where bars can be placed to divide the stars into non-empty groups. Note that there are 5 spaces to place the bars. Since we want 4 groups, we use 3 bars. Then there are ( 5 3 ) = 10 \binom{5}{3}=10 ways to group the 6 stars into 4 groups. Likewise, there are 10 ways to group the 6 upward movements into 4 groups.

We can count the ways to group the rightward movements in a similar way. There are ( 9 3 ) = 84 \binom{9}{3}=84 ways to group the rightward movements into 4 groups.

Since these groupings are independent of each other, we can count the total number of ways to travel with 4 groups of upward movements and 4 groups of rightward movements. Note the multiplication by 2 because we can either start with an upward movement or a rightward movement:

2 ( 5 3 ) ( 9 3 ) = 2 × 10 × 84 = 1680 2\binom{5}{3}\binom{9}{3}=2\times 10\times 84=\boxed{1680}


In the general case of p p rightward movements, q q upward movements, and r r turns, the number of paths is:

{ If r is even: ( p 1 r / 2 ) ( q 1 r / 2 1 ) + ( p 1 r / 2 1 ) ( q 1 r / 2 ) If r is odd: 2 ( p 1 ( r 1 ) / 2 ) ( q 1 ( r 1 ) / 2 ) \begin{cases}\begin{array}{rl} \text{If } r \text{ is even:} & \binom{p-1}{r/2}\binom{q-1}{r/2-1}+\binom{p-1}{r/2-1}\binom{q-1}{r/2} \\ \text{If } r \text{ is odd:} & 2\binom{p-1}{(r-1)/2}\binom{q-1}{(r-1)/2} \\ \end{array}\end{cases}

In the case of r r even, there aren't the same number of upward movements and rightward movements.

Interesting that you got the solution from 9!5!/(4!5!3!2!) + 9!5!/(6!3!4!1!). I thought that with even numbers of "up" and "right" movements it was easier to express as

2 x 9!5!/(6!3!3!2!).

Malcolm Rich - 3 years, 11 months ago

Doesn't this double count identical paths? There's 24 ways to arrange the distances {1,2,3,4} but only 4 distinct ways to arrange {1,1,1,7}, and for that reason I am curious whether it's possible the above method doesn't over count. I got 1060 ways (10 70+10 36).

Ban Yan - 3 years, 11 months ago

your general formula is wrong. for example for (3,3) grid and 3 turns, there are 8 paths. your formula suggests only 4.

The error in your analysis is that the last turn has no option and must occur on the last row/column (while the other coordinate was decide by the previous turn), so there are actually only r 1 r-1 turns to consider.

{ If r is even: ( p 1 r / 2 ) ( q 1 r / 2 1 ) + ( p 1 r / 2 1 ) ( q 1 r / 2 ) If r is odd: 2 ( p 1 ( r 1 ) / 2 ) ( q 1 ( r 1 ) / 2 ) \begin{cases}\begin{array}{rl} \text{If } r \text{ is even:} & \binom{p-1}{r/2}\binom{q-1}{r/2-1}+\binom{p-1}{r/2-1}\binom{q-1}{r/2} \\ \text{If } r \text{ is odd:} & 2\binom{p-1}{(r-1)/2}\binom{q-1}{(r-1)/2} \\ \end{array}\end{cases}

Nir Hamawi - 3 years, 11 months ago

Log in to reply

You're right! I corrected my solution.

Andy Hayes - 3 years, 11 months ago

Alternatively to stars and bars; you can also consider: if we go up first, then the other ( r 1 ) / 2 (r-1)/2 upward movements must occur in distinct columns that cannot be the first or last. There are p + 1 p+1 columns, therefore ( p 1 ( r 1 ) / 2 ) {p-1}\choose{(r-1)/2} choices for the upward movements.

Matt McNabb - 3 years, 11 months ago
Arpon Paul
Jun 22, 2017

Observation 1: As Feynman cannot move in the x -x or y -y direction, the path is guaranteed to be inside the rectangle:

Observation 2: Suppose, Feynman starts along the x-axis.Then he makes a turn, and now he is moving along the y axis. He makes another turn and he is moving along x axis again. So it is evident that if Feynman's first step is along the x-axis, and he makes even number of turns, then his last step must be along the x-axis as well. And so on.

Observation 3: If r r is an even number and Feynman's first and last steps are along the x-axis, then r 2 \frac{r}{2} turns will be from x-axis to y-axis, and the other r 2 \frac{r}{2} turns will be from y-axis to x-axis. For example, there are three x y x\rightarrow y turns (shown by orange squares) and three y x y\rightarrow x turns (shown by blue squares) in the figure below:

Observation 4: If r r is an odd number and Feynman's first and last steps are along the x-axis and y-axis respectively, then there will be r + 1 2 \frac{r+1}{2} number of x y x\rightarrow y turns, and r 1 2 \frac{r-1}{2} number of y x y\rightarrow x turns. For example, there are three x y x\rightarrow y turns (shown by orange squares) and two y x y\rightarrow x turns (shown by blue squares) in the figure below:

Observation 5: Suppose Feynman makes a turn at a point ( m , n ) (m,n) where 0 < m < p 0<m<p and 0 < n < q 0<n<q , then surely he makes one other turn at some point on the line x = m x=m and yet another turn at some other point on the line y = n y=n .

First consider the case when r r is an even number:

i) Starts and ends along the x axis

There are r 2 \frac{r}{2} number of x y x\rightarrow y turns, and r 2 \frac{r}{2} number of y x y\rightarrow x turns. Notice, the first and last steps are along y = 0 y=0 and y = q y=q lines. Surely there is a x y x\rightarrow y turn on y = 0 y=0 line and a y x y\rightarrow x turn on y = q y=q line. Now he chooses r 2 \frac{r}{2} lines from among the p 1 p-1 vertical lines : x = 1 , x = 2 , . . . , x = p 1 x=1,~x=2,~...,~x=p-1 and r 2 1 \frac{r}{2}-1 lines from among the q 1 q-1 horizontal lines : y = 1 , y = 2 , . . . , y = q 1 y=1,~y=2,~...,~y=q-1 ; For example, say r = 6 r=6 . Feynman chooses lines : x = 1 , x = 3 , x = 4 x=1,~x=3,~x=4 and y = 1 , y = 3 y=1,~ y=3 :

Now corresponding to this choice of lines, the path will be:

It is easy to see that there are p 1 C r 2 q 1 C r 2 1 ^{p-1}C_{\frac{r}{2}} \cdot ~^{q-1}C_{\frac{r}{2}-1} ways of choosing those combinations of lines.

ii) Starts and ends along the y axis

In the same way, for this case, the number of possible ways is p 1 C r 2 1 q 1 C r 2 ^{p-1}C_{\frac{r}{2}-1} \cdot ~^{q-1}C_{\frac{r}{2}}

Therefore, when r r is even, the total number of possible ways is p 1 C r 2 q 1 C r 2 1 + p 1 C r 2 1 q 1 C r 2 ^{p-1}C_{\frac{r}{2}} \cdot ~^{q-1}C_{\frac{r}{2}-1}~+~^{p-1}C_{\frac{r}{2}-1} \cdot ~^{q-1}C_{\frac{r}{2}}

Now consider the case when r r is an odd number: In the same procedure, it can be shown that the number of possible ways are 2 p 1 C r 1 2 q 1 C r 1 2 2\cdot~^{p-1}C_{\frac{r-1}{2}} \cdot ~^{q-1}C_{\frac{r-1}{2}} .

You've spent some serious time on this solution.

Rajdeep Ghosh - 3 years, 11 months ago

Truely awesome

Aditya Kumar - 3 years, 7 months ago
Malcolm Rich
Jul 3, 2017

With each step being made as either a "right" move or "up" move and knowing there are 4 steps in each direction. The route to (10,6) can be seen as a combination of independent moves along the x and y-axes.

4 steps to (0,6) has 5!/3!2! different routes and 4 steps to (10,0) has 9!/6!3! different routes

Multiply these to get 840. Then double this to reflect the starting direction along either axis.

Hi, Could you please explain the step "4 steps to (0,6) has 5!/3!2! different routes" in a bit more detail please. I follow that there must be 4 'right' and 4 'up' steps but the paths to (0,6) and 5C3 has me stumped.

Cheers Liam

Liam Coleman-Hughes - 3 years, 11 months ago

Log in to reply

In this particular example it can be reached either in steps of 1,1,1,3 (4 ways) or in steps of 1,1,2,2 (6 ways).

In the more general case with m steps to reach n, it can be demonstrated inductively to be equal to (n-1)!/[(n-m)!(m-1)!]. Just consider f (n,m) = Sum f (x,m-1) for m-1 <=x <n and a familiar pattern develops.

Malcolm Rich - 3 years, 11 months ago
Kevin Tong
Jul 3, 2017

Notice that when Feynman has to turn 7 times, he must move forward 4 times in the horizontal direction and 4 times in the vertical direction to get the destination ( 10 , 6 ) (10,6) . Also, notice we can either start in the horizontal direction or the vertical direction, so we multiple our result by 2 2 when we're done. Now, we want to find the number of ways we can express 10 10 and 6 6 as the sum of 4 4 positive numbers (since each horizontal or vertical segment Feynman moves must be positive and add up to the final x or y position). So we can start listing out these ways and find the number of ways we can order the numbers. 10 1 + 1 + 1 + 7 : ( 4 1 ) = 4 ! 1 ! 3 ! = 4 1 + 1 + 2 + 6 : ( 4 2 ) ( 2 1 ) = 4 ! 2 ! 2 ! 2 ! 1 ! 1 ! = 6 2 = 12 1 + 1 + 3 + 5 : ( 4 2 ) ( 2 1 ) = 4 ! 2 ! 2 ! 2 ! 1 ! 1 ! = 6 2 = 12 1 + 1 + 4 + 4 : ( 4 2 ) = 4 ! 2 ! 2 ! = 6 1 + 2 + 3 + 4 : 4 ! = 24 1 + 2 + 2 + 5 : ( 4 2 ) ( 2 1 ) = 4 ! 2 ! 2 ! 2 ! 1 ! 1 ! = 6 2 = 12 1 + 3 + 3 + 3 : ( 4 1 ) = 4 ! 1 ! 3 ! = 4 2 + 2 + 2 + 4 : ( 4 1 ) = 4 ! 1 ! 3 ! = 4 2 + 2 + 3 + 3 : ( 4 2 ) = 4 ! 2 ! 2 ! = 6 T o t a l : 4 + 12 + 12 + 6 + 24 + 12 + 4 + 4 + 6 = 84 6 1 + 1 + 1 + 3 : ( 4 1 ) = 4 ! 1 ! 3 ! = 4 1 + 1 + 2 + 2 : ( 4 2 ) = 4 ! 2 ! 2 ! = 6 T o t a l = 4 + 6 = 10 \textbf{10} \\ 1+1+1+7: \binom{4}{1} = \frac{4!}{1! \cdot 3!} = \boxed{4} \\ 1+1+2+6: \binom{4}{2} \cdot \binom{2}{1} = \frac{4!}{2!\cdot2!} \cdot \frac{2!}{1! \cdot 1!} = 6\cdot2 = \boxed{12} \\1+1+3+5: \binom{4}{2} \cdot \binom{2}{1} = \frac{4!}{2!\cdot2!} \cdot \frac{2!}{1! \cdot 1!} = 6\cdot2 = \boxed{12} \\ 1+1+4+4: \binom{4}{2} = \frac{4!}{2!\cdot2!} = \boxed{6} \\ 1+2+3+4: 4! = \boxed{24}\\1+2+2+5: \binom{4}{2} \cdot \binom{2}{1} = \frac{4!}{2!\cdot2!} \cdot \frac{2!}{1! \cdot 1!} = 6\cdot2 = \boxed{12} \\1+3+3+3: \binom{4}{1}= \frac{4!}{1! \cdot 3!}= \boxed{4} \\2+2+2+4: \binom{4}{1}= \frac{4!}{1! \cdot 3!}= \boxed{4}\\2+2+3+3: \binom{4}{2}= \frac{4!}{2! \cdot 2!}= \boxed{6}\\Total: 4+12+12+6+24+12+4+4+6=84\\ \\ \\\textbf{6}\\1+1+1+3: \binom{4}{1}=\frac{4!}{1!\cdot3!}=\boxed{4}\\1+1+2+2: \binom{4}{2} = \frac{4!}{2!\cdot2!}=\boxed{6}\\Total = 4+6=10 We can now see that there are 84 84 ways to order the horizontal segments and 10 10 ways to order the vertical segments. Now, we multiple these together (Since we must pair the horizontal combination with the vertical combination in the end) and then multiple them by 2 2 (We can start horizontally or vertically). 84 10 2 = 840 2 = 1680 84 \cdot 10 \cdot 2 = 840 \cdot 2 = \boxed{1680}

Richard Desper
Jul 9, 2017

What we are looking for here is the number of sequences ( a 1 , b 1 , a 2 , b 2 , a 3 , b 3 , a 4 , b 4 ) (a_1,b_1,a_2,b_2,a_3,b_3,a_4,b_4) where all terms are positive integers, and either (i) i a i = 6 \sum_i a_i = 6 and j b j = 10 \sum_j b_j = 10 or (ii) i a i = 10 \sum_i a_i = 10 and j b j = 6 \sum_j b_j = 6 The first type of sequence represents paths that go up first, and has four different upward paths of lengths a 1 , a 2 , a 3 , a_1, a_2, a_3, and a 4 a_4 , respectively, and 4 different rightward paths of lengths b 1 , b 2 , b 3 , b_1, b_2, b_3, and b 4 b_4 respectively. The sequence type of sequence represents those paths that start by going right and end by going up instead. It is clear that the number of sequences in part (i) is the same as the number of sequences in part (ii) (If not clear: map from one set to the other by moving first step to the end or vice versa).
Let p n , k p_{n,k} be the number of sequences of n positive integers that sum up to k k . It is clear that the quantity we are interested in will be 2 p 4 , 6 p 4 , 10 2 * p_{4,6}*p_{4,10} .

Thankfully, we can express p n , k p_{n,k} in a closed form for all n , k n,k .

Lemma : for any value of k n , p n , k = ( k 1 n 1 ) k \geq n, p_{n,k} = {{k-1}\choose{n-1}} To arrive at this identity, consider what we are doing when we select such a sequence. We are essentially putting k k balls in n n bins, but with the constraint that each bin must have at least one ball. Equivalently, we are putting ( k n ) (k-n) balls in n n bins with no restrictions at all.

As others have noted, such a choice can be illustrated by a sequence of * 's and | 's (stars and bars), with a bar placed between collections of stars to indicate the change in bins. (For example, one way to put 5 objects in 3 bins would be **| |*** .) Each sequence of stars and bars represents a different sequence, and the mapping is a complete enumeration. How many stars and bars figures are there? Note that there are ( k n ) (k-n) stars in this figure and ( n 1 ) (n-1) bars. Thus there are ( k 1 ) (k-1) total symbols of which exactly ( n 1 ) (n-1) are bars, i.e. the number of sequences is ( k 1 n 1 ) {{k-1}\choose{n-1}} .

For our problem we use p 4 , 6 = ( 5 3 ) = 10 p_{4,6} = {{5}\choose{3}} = 10 and p 4 , 10 = ( 9 3 ) = 84 p_{4,10} = {{9}\choose{3}} = 84 . Summing over the parts, the total number of paths is 2 p 4 , 6 p 4 , 10 = 2 10 84 = 1680 2*p_{4,6}*p_{4,10} = 2*10*84 = 1680 .

Eli Jaffe
Jul 3, 2017

I noted that 7 turns means 8 total segments, 4 vertical and 4 horizontal. So, the total number of paths is the number of different combinations of x-values for our 4 vertical seconds, multiplied by the total possible permutations of lengths of the paths. Since we have 10 possible x-values, we have 10choose4 possible combinations of vertical bar arrangements. The rest of the path is clearly fully determined just by connecting the vertical paths by horizontal lines. For any given path, the sum of the lengths of the vertical paths must be 6. All paths least have length at least 1, and no more than 3, as to not violate the first condition for the other paths. This leaves 8 total combinations of lengths: 1113,1131,1122,1221,1211,2112,2121, and 2211. Thus, our total number of paths is 210*8=1680!

James Boudinot
Jul 5, 2017

Measure the steps not from gridpoint to gridpoint, but from midpoint to midpoint ( thru the intervening gridpoint). Then each turn is a "step" of length one, half to the right and half up. The journey must begin with a half step in one direction (x or y) and end with a half step in the other direction. Ergo, rotating an x-starting path 180 degrees produces a different y-starting path. Ergo, the answer is twice the number of x-starting paths. So assume an x-starting path. Each of the 7 turns goes up and right 1/2 step, for a total of 3 1/2 steps in each direction. The last step is a half-step up, for a total of 4 up-steps. The remaining two up-steps are placed directly following the four odd-numbered turns. There are only 10 ways to do this:
2000,0200,0020,0002,1100,1010,1001,0110,0101,0011.

Similarly, the six remaining right-steps come right before each odd-numbered turn. This one takes more counting but totals to 84: (6,0,0,0)...4 (5,1,0,0)...12 (4,2,0,0)...12 (4,1,1,0)...12 (3,3,0,0)...6 (3,2,1,0)...24 (3,1,1,1)...4 (2,2,2,0)...4 (2,2,1,1)...6

The placements of the up and right steps are independent, so the total number of x-starting paths is 10x84=840, and the overall total is twice that, 1680.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...