Random Robot Roaming 2

A robot starts on a dot of a grid, makes 20 20 moves of one unit with each move in a randomly selected direction (up, down, left, or right), and then stops. The robot does not move diagonally.

If the probability that the robot stops 2 2 units or less away from its starting point is a 2 b 2 \frac{a^2}{b^2} , where a a and b b are relatively prime positive integers, find a + b a + b .

Inspiration

Note: A computer program is not necessary to solve this problem.


The answer is 392313.

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

Mark Hennings
Mar 25, 2020

We need the key binomial identities: a = 0 n ( n a ) 2 = ( 2 n n ) a = 0 n ( n a ) ( n + k a + k ) = ( 2 n + k n ) a = 0 n ( n a ) ( n + k + 1 a + k ) = ( 2 n + k + 1 n + 1 ) \begin{aligned} \sum_{a=0}^n \binom{n}{a}^2 & = \; \binom{2n}{n} \\ \sum_{a=0}^n \binom{n}{a}\binom{n+k}{a+k} & = \; \binom{2n+k}{n} \\ \sum_{a=0}^n \binom{n}{a}\binom{n+k+1}{a+k} & = \; \binom{2n+k+1}{n+1} \end{aligned} for n , k N n,k \in \mathbb{N} . We can prove these identities by considering the coefficient of X n X^n in ( 1 + X ) 2 n = ( 1 + X ) n ( 1 + X ) n (1+X)^{2n} = (1+X)^n(1+X)^n , the coefficient of X n X^n in ( 1 + X ) 2 n + k = ( 1 + X ) n ( 1 + X ) n + k (1+X)^{2n+k} = (1+X)^n(1+X)^{n+k} and the coefficient of X n + 1 X^{n+1} in ( 1 + X ) 2 n + k + 1 = ( 1 + X ) n ( 1 + X ) n + k + 1 (1+X)^{2n+k+1} = (1+X)^n(1+X)^{n+k+1} respectively.

If the robot starts at ( 0 , 0 ) (0,0) , we want to know the probabiltiy of it landing on one of ( 0 , 0 ) (0,0) , ( 2 , 0 ) (2,0) , ( 0 , 2 ) (0,2) , ( 0 , 2 ) (0,-2) , ( 0 , 2 ) (0,-2) , ( 1 , 1 ) (1,1) , ( 1 , 1 ) (-1,1) , ( 1 , 1 ) (-1,-1) , ( 1. 1 ) (1.-1) after 20 moves.

The robot will land on ( 0 , 0 ) (0,0) if it has made an equal number of "up" and "down" moves, and an equal number of "left" and "right" moves. There are a 1 = a = 0 10 20 ! a ! a ! ( 10 a ) ! ( 10 a ) ! = a = 0 10 ( 20 10 ) ( 10 a ) 2 = ( 20 10 ) 2 a_1 \; = \; \sum_{a=0}^{10} \frac{20!}{a! a! (10-a)! (10-a)!} \; = \; \sum_{a=0}^{10} \binom{20}{10} \binom{10}{a}^2 \; = \; \binom{20}{10}^2 ways in which it can do this.

The robot will land on ( 2 , 0 ) (2,0) if it has made an equal number of "up" and "down" moves, and two more "right" moves than "left" moves. There are a 2 = a = 0 9 20 ! ( a + 2 ) ! a ! ( 9 a ) ! ( 9 a ) ! = a = 0 9 ( 9 a ) ( 11 a ) ( 20 11 ) = ( 20 9 ) ( 20 11 ) a_2 \; = \; \sum_{a=0}^9 \frac{20!}{(a+2)! a! (9-a)! (9-a)!} \; = \; \sum_{a=0}^9 \binom{9}{a}\binom{11}{a}\binom{20}{11} \; = \; \binom{20}{9}\binom{20}{11} ways in which it can do this.

The robot will land on ( 1 , 1 ) (1,1) if it has made one more "up" move than "down" moves, and one more "right" move than "left" moves. There are a 3 = a = 0 9 20 ! ( a + 1 ) ! a ! ( 10 a ) ! ( 9 a ) ! = a = 0 9 ( 9 a ) ( 11 a + 1 ) ( 20 11 ) = ( 20 10 ) ( 20 11 ) a_3 \; = \; \sum_{a=0}^9 \frac{20!}{(a+1)! a! (10-a)! (9-a)!} \; = \; \sum_{a=0}^9 \binom{9}{a}\binom{11}{a+1}\binom{20}{11} \; = \; \binom{20}{10}\binom{20}{11} ways in which it can do this.


An alternative argument goes as follows. Suppose that the robot tosses two distinct coins. If it tosses HH, it moves right. If it tosses HT, it moves up. If it tosses TH it moves down. If it tosses TT it moves left.

If the robot is to land on ( 0 , 0 ) (0,0) , the first coin must toss an equal number of heads and tails ( 10 10 of each) and the second coin must also toss an equal number of heads and tails. Thus there are a 1 = ( 20 10 ) 2 a_1 \; = \; \binom{20}{10}^2 ways for this to happen.

If the robot is to land on ( 2 , 0 ) (2,0) , the first coin must toss two more heads than tails, and the second coin must also toss two more heads than tails. Thus there are a 2 = ( 20 11 ) ( 20 11 ) a_2 \; = \; \binom{20}{11}\binom{20}{11} ways for this to happen.

If the robot is to land on ( 1 , 1 ) (1,1) , the first coin must toss two more heads than tails, while the second coin must toss an equal number of heads and tails. Thus there are a 3 = ( 20 11 ) ( 20 10 ) a_3 \; = \; \binom{20}{11}\binom{20}{10} ways for this to happen.


Thus, by symmetry, there are a 1 + 4 a 2 + 4 a 3 = ( 20 ! ) 2 ( 10 ! ) 4 ( 9 ! ) 2 ( 11 ! ) 2 { ( 9 ! ) 2 ( 11 ! ) 2 + 4 ( 10 ! ) 4 + 4 ( 10 ! ) 2 9 ! 11 ! } = ( 20 ! ) 2 ( 10 ! ) 4 ( 9 ! ) 2 ( 11 ! ) 2 ( 2 ( 10 ! ) 2 + 9 ! 11 ! ) 2 = [ 20 ! ( 2 ( 10 ! ) 2 + 9 ! 11 ! ) ( 10 ! ) 2 9 ! 11 ! ] 2 = [ ( 20 10 ) 200 + 110 110 ] 2 = [ 31 11 ( 20 10 ) ] 2 \begin{aligned} a_1 + 4a_2 + 4a_3 & = \; \frac{(20!)^2}{(10!)^4(9!)^2(11!)^2}\left\{ (9!)^2(11!)^2 + 4(10!)^4 + 4(10!)^2 9! 11!\right\} \; = \; \frac{(20!)^2}{(10!)^4(9!)^2(11!)^2}\left( 2(10!)^2 + 9! 11!\right)^2 \\ & = \; \left[\frac{20!(2(10!)^2 + 9! 11!)}{(10!)^2 9! 11!}\right]^2 \; = \; \left[ \binom{20}{10} \frac{200 + 110}{110} \right]^2 \; = \; \left[\frac{31}{11}\binom{20}{10}\right]^2 \end{aligned} ways in which the robot can end up within 2 2 units of its starting point, and so the probability that the robot ends up within 2 2 units of its starting point is a 1 + 4 a 2 + 4 a 3 4 20 = [ 31 11 × 4 10 ( 20 10 ) ] 2 = a 2 b 2 \frac{a_1 + 4a_2 + 4a_3}{4^{20}} \; = \; \left[\frac{31}{11 \times 4^{10}}\binom{20}{10}\right]^2 \; = \; \frac{a^2}{b^2} where a b = 31 11 × 4 10 ( 20 10 ) = 130169 262144 \frac{a}{b} \; = \; \frac{31}{11 \times 4^{10}} \binom{20}{10} \; = \; \frac{130169}{262144} making the answer 130169 + 262144 = 392313 130169 + 262144 = \boxed{392313} .

David Vreken
Mar 28, 2020

It's helpful to compare the possible positions of the robot after the first few moves to numbers in layers of a pyramid, as follows:

After 0 0 moves, the robot is at the starting point with only 1 1 way to get there. After 1 1 move, the robot can be either up 1 1 , right 1 1 , down 1 1 , or left 1 1 from the starting point, all with only 1 1 way to get there each time. After 2 2 moves, the robot can move either up 1 1 , right 1 1 , down 1 1 , or left 1 1 after wherever the robot ended up after the first move. That means, for example, that there are 4 4 ways to get back to the starting point (up 1 1 down 1 1 , down 1 1 up 1 1 , right 1 1 left 1 1 , or left 1 1 right 1 1 ). We can observe, then, that each block in the pyramid layer is the sum of the blocks that overlap it in the layer above .

With this rule we can also prove inductively that any block in the x th x^{\text{th}} column and y th y^{\text{th}} row in the layer after m m moves is ( m x 1 ) ( m y 1 ) {m \choose x - 1}{m \choose y - 1} (see below for proof). For example, the number in the block in the 2 nd 2^{\text{nd}} column and 2 nd 2^{\text{nd}} row in the layer after 2 2 moves is ( 2 2 1 ) ( 2 2 1 ) = 4 {2 \choose 2 - 1}{2 \choose 2 - 1} = 4 , which we already found.

If the robot starts at ( 0 , 0 ) (0, 0) on the grid, then it must stop on either ( 0 , 0 ) (0, 0) , ( ± 1 , ± 1 ) (\pm 1, \pm 1) , ( ± 2 , 0 ) (\pm 2, 0) , or ( 0 , ± 2 ) (0, \pm 2) to be 2 2 units or less away from its starting point (note that ( ± 1 , 0 ) (\pm 1, 0) , or ( 0 , ± 1 ) (0, \pm 1) are not possible since they are all an odd distance away), and these coordinates correspond with the 1 0 th 10^{\text{th}} , 1 1 th 11^{\text{th}} , and 1 2 th 12^{\text{th}} columns and rows of the pyramid layer. This makes the probability:

1 4 20 x = 10 12 ( 20 x 1 ) y = 10 12 ( 20 y 1 ) = 13016 9 2 26214 4 2 \displaystyle \frac{1}{4^{20}} \sum_{x = 10}^{12}{20 \choose x - 1} \sum_{y = 10}^{12} {20 \choose y - 1} = \frac{130169^2}{262144^2}

so a = 130169 a = 130169 , b = 262144 b = 262144 , and a + b = 392313 a + b = \boxed{392313} .


Proof by Induction:

For the first block, ( m , x , y ) = ( 0 , 1 , 1 ) (m, x, y) = (0, 1, 1) , so its value is ( 0 1 1 ) ( 0 1 1 ) = 1 {0 \choose 1 - 1}{0 \choose 1 - 1} = 1 .

The four blocks that overlap a ( m + 1 , x , y ) (m + 1, x, y) block from above are ( m , x , y ) (m, x, y) , ( m , x 1 , y ) (m, x - 1, y) , ( m , x , y 1 ) (m, x, y - 1) , and ( m , x 1 , y 1 ) (m, x - 1, y - 1) , and their values add up to ( m x 1 ) ( m y 1 ) + ( m x 2 ) ( m y 1 ) + ( m x 1 ) ( m y 2 ) + ( m x 2 ) ( m y 2 ) {m \choose x - 1}{m \choose y - 1} + {m \choose x - 2}{m \choose y - 1} + {m \choose x - 1}{m \choose y - 2} + {m \choose x - 2}{m \choose y - 2} , which is equivalent to ( m + 1 x 1 ) ( m + 1 y 1 ) {m + 1 \choose x - 1}{m + 1 \choose y - 1} , the value of the ( m + 1 , x , y ) (m + 1, x, y) block.

Therefore, the value of any block is ( m x 1 ) ( m y 1 ) {m \choose x - 1}{m \choose y - 1} .

Nice question and solution! Note that LHS of the equation with the product of two sums should be divided by 4 20 4^{20} .

Hypergeo H. - 1 year, 2 months ago

Log in to reply

Good catch! I edited my solution.

David Vreken - 1 year, 2 months ago
Hypergeo H.
Apr 3, 2020

This is an updated and more direct solution.

TLDR : The furthest locations (edges) the robot can reach forms a diamond (actually a tilted square), of axes u , v u, v , say. The number of ways it can reach each point of the edges corresponds to ( 2 n m ) \binom {2n}{m} which is the 2 n 2n -th row of the Pascal triangle. The number of ways to reach a location in the interior is the product of the number of ways to reach each of its u u and v v coordinates on the edges (axes) respectively.


Full Solution :

1D version

This problem can be analysed as a 2D version of the original Random Robot question, which is a 1D version. Assume that the robot can only move along a straight line i.e. up or down, starting from the origin. We want to determine the number of ways to arrive at position 2 m 2m after 2 n 2n moves, where 0 m n 0\le m\le n . The robot must make n + m n+m moves in the +ve direction and n m n-m moves in the -ve direction, with moves taken in any order. Hence the total number of ways to end up at 2 m 2m is
( 2 n n + m ) \displaystyle \binom {2n}{n+m} .
The number of ways to arrive at each position 2 m 2m (where n m n ) -n\le m\le n) are the numbers from the 2 n 2n -th row of the Pascal triangle. An illustration for the case n = 3 n=3 is shown as part of the diagram above i.e. green boxes for the u u axis (or v v ).


2D version (Present problem)

Let 2 n 2n be the total number of steps taken. Refer to the diagram above (diagram shows the case for n = 3 n=3 WLOG) and note axes u , v u, v . The robot starts at the centre position at ( u , v ) = ( 0 , 0 ) (u,v) = (0,0) . Robot steps are indicated in purple squares. Each time the robot takes a step (up/down/left/right), it is making a one move each in the u u and v v directions simultaneously. Hence the number of ways to arrive at at a location ( u , v ) = ( 2 i , 2 j ) (u,v) = (2i, 2j) ( where 0 i , j n ) 0\le i,j\le n) after 2 n 2n moves is
( 2 n n + i ) ( 2 n n + j ) \binom {2n}{n+i}\binom {2n}{n+j} .

The number of ways to end up at a location no more than two units away from the origin is given by summing over all i , j i,j where 2 i , 2 j 2 |2i, 2j| \le 2 i.e. 0 i , j 1 0\le i,j\le 1 , which gives
S 2 n = i = 1 1 ( 2 n n + i ) j = 1 1 ( 2 n n + j ) = ( i = 1 1 ( 2 n n + i ) ) 2 = ( ( 2 n n 1 ) + ( 2 n n ) + ( 2 n n + 1 ) ) . S_{2n}= \sum_{i=-1}^1 \binom {2n}{n+i} \sum_{j=-1}^1 \binom {2n}{n+j} = \left(\sum_{i=-1}^1 \binom {2n}{n+i}\right)^2 = \left( \binom {2n}{n-1}+\binom{2n}n + \binom {2n}{n+1}\right).

For the illustration given, this is S 6 = ( ( 6 2 ) + ( 6 3 ) + ( 6 4 ) ) 2 = 5 0 2 = 2500. S_6 = \left( \binom 62+\binom 63+\binom 64\right)^2 =50^2 = 2500.

In the given question, total number of moves is 20 i.e. n = 10 n=10 , which gives S 20 = ( ( 20 9 ) + ( 20 10 ) + ( 20 11 ) ) 2 . S_{20} = \left( \binom {20}9+\binom {20}{10}+\binom {20}{11}\right)^2.

The total number of possible journeys is 4 20 4^{20} . Therefore the probability of ending at locations two units or less from the origin is given by
A 2 B 2 = S 20 4 20 \frac {A^2}{B^2} =\frac {S_{20}}{4^{20}}

where

A B = ( 20 9 ) + ( 20 10 ) + ( 20 11 ) 4 10 = 510676 1048576 = 130169 262144 = a b \frac AB =\frac { \displaystyle\binom {20}9 + \binom {20}{10}+\binom {20}{11}}{4^{10}} =\frac {510676}{1048576} = \frac {130169}{262144} = \frac ab

where a = 130169 , b = 262144 a=130169, b=262144 and a , b a, b are co-prime.

Hence a + b = 130169 + 262144 = 392313. a+b = 130169 + 262144 = \color{#D61F06}{392313}. \; \; \; \blacksquare


General case : It is interesting to note that the number of ways of ending at locations 2p units or less from the origin is given by ( ( 2 n n p ) + + ( 2 n n ) + + ( 2 n n + p ) ) 2 \left (\binom {2n}{n-p}+ \cdots+\binom {2n}n +\cdots+\binom {2n}{n+p}\right )^2 . When p = n p=n , this becomes ( 2 2 n ) 2 = 4 2 n (2^{2n})^2 =4^{2n} , as expected.


NB: Alternatively, this can be solved using 2-dimensional convolution. This is similar to the solution posted by OP.

how can I make the table below smaller? I've been having to save my pictures as gif files instead of png files, because for some reason png files expand to too large when displayed in a solution.

David Vreken - 1 year, 2 months ago

Thanks! It does look a bit smaller now.

Hypergeo H. - 1 year, 2 months ago
Yuriy Kazakov
Mar 28, 2020

The solution is the same David Vreken. Calculate C ( 20 , k ) C(20,k) by Excel - first green line. Second green line is C ( 20 , k ) C ( 20 , 1 C(20,k)C(20,1 ), next lines C ( 20 , k ) C ( 20 , 2 ) C(20,k)C(20,2) , C ( 20 , k ) C ( 20 , 3 ) C(20,k)C(20,3) and so on. Sum of Blue numbers give way to answer.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...