A robot starts on a dot of a grid, makes
2
0
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 units or less away from its starting point is b 2 a 2 , where a and b are relatively prime positive integers, find a + b .
Note: A computer program is not necessary to solve this problem.
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.
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 moves, the robot is at the starting point with only 1 way to get there. After 1 move, the robot can be either up 1 , right 1 , down 1 , or left 1 from the starting point, all with only 1 way to get there each time. After 2 moves, the robot can move either up 1 , right 1 , down 1 , or left 1 after wherever the robot ended up after the first move. That means, for example, that there are 4 ways to get back to the starting point (up 1 down 1 , down 1 up 1 , right 1 left 1 , or left 1 right 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 column and y th row in the layer after m moves is ( x − 1 m ) ( y − 1 m ) (see below for proof). For example, the number in the block in the 2 nd column and 2 nd row in the layer after 2 moves is ( 2 − 1 2 ) ( 2 − 1 2 ) = 4 , which we already found.
If the robot starts at ( 0 , 0 ) on the grid, then it must stop on either ( 0 , 0 ) , ( ± 1 , ± 1 ) , ( ± 2 , 0 ) , or ( 0 , ± 2 ) to be 2 units or less away from its starting point (note that ( ± 1 , 0 ) , or ( 0 , ± 1 ) are not possible since they are all an odd distance away), and these coordinates correspond with the 1 0 th , 1 1 th , and 1 2 th columns and rows of the pyramid layer. This makes the probability:
4 2 0 1 x = 1 0 ∑ 1 2 ( x − 1 2 0 ) y = 1 0 ∑ 1 2 ( y − 1 2 0 ) = 2 6 2 1 4 4 2 1 3 0 1 6 9 2
so a = 1 3 0 1 6 9 , b = 2 6 2 1 4 4 , and a + b = 3 9 2 3 1 3 .
Proof by Induction:
For the first block, ( m , x , y ) = ( 0 , 1 , 1 ) , so its value is ( 1 − 1 0 ) ( 1 − 1 0 ) = 1 .
The four blocks that overlap a ( m + 1 , x , y ) block from above are ( m , x , y ) , ( m , x − 1 , y ) , ( m , x , y − 1 ) , and ( m , x − 1 , y − 1 ) , and their values add up to ( x − 1 m ) ( y − 1 m ) + ( x − 2 m ) ( y − 1 m ) + ( x − 1 m ) ( y − 2 m ) + ( x − 2 m ) ( y − 2 m ) , which is equivalent to ( x − 1 m + 1 ) ( y − 1 m + 1 ) , the value of the ( m + 1 , x , y ) block.
Therefore, the value of any block is ( x − 1 m ) ( y − 1 m ) .
Nice question and solution! Note that LHS of the equation with the product of two sums should be divided by 4 2 0 .
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 , say. The number of ways it can reach each point of the edges corresponds to ( m 2 n ) which is the 2 n -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 and 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
after
2
n
moves, where
0
≤
m
≤
n
. The robot must make
n
+
m
moves in the +ve direction and
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
is
(
n
+
m
2
n
)
.
The number of ways to arrive at each position
2
m
(where
−
n
≤
m
≤
n
)
are the numbers from the
2
n
-th row of the Pascal triangle.
An illustration for the case
n
=
3
is shown as part of the diagram above i.e. green boxes for the
u
axis (or
v
).
2D version (Present problem)
Let
2
n
be the total number of steps taken. Refer to the diagram above (diagram shows the case for
n
=
3
WLOG) and note axes
u
,
v
. The robot starts at the centre position at
(
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
and
v
directions simultaneously. Hence the number of ways to arrive at at a location
(
u
,
v
)
=
(
2
i
,
2
j
)
( where
0
≤
i
,
j
≤
n
)
after
2
n
moves is
(
n
+
i
2
n
)
(
n
+
j
2
n
)
.
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
where
∣
2
i
,
2
j
∣
≤
2
i.e.
0
≤
i
,
j
≤
1
, which gives
S
2
n
=
i
=
−
1
∑
1
(
n
+
i
2
n
)
j
=
−
1
∑
1
(
n
+
j
2
n
)
=
(
i
=
−
1
∑
1
(
n
+
i
2
n
)
)
2
=
(
(
n
−
1
2
n
)
+
(
n
2
n
)
+
(
n
+
1
2
n
)
)
.
For the illustration given, this is S 6 = ( ( 2 6 ) + ( 3 6 ) + ( 4 6 ) ) 2 = 5 0 2 = 2 5 0 0 .
In the given question, total number of moves is 20 i.e. n = 1 0 , which gives S 2 0 = ( ( 9 2 0 ) + ( 1 0 2 0 ) + ( 1 1 2 0 ) ) 2 .
The total number of possible journeys is
4
2
0
.
Therefore the probability of ending at locations two units or less from the origin is given by
B
2
A
2
=
4
2
0
S
2
0
where
B A = 4 1 0 ( 9 2 0 ) + ( 1 0 2 0 ) + ( 1 1 2 0 ) = 1 0 4 8 5 7 6 5 1 0 6 7 6 = 2 6 2 1 4 4 1 3 0 1 6 9 = b a
where a = 1 3 0 1 6 9 , b = 2 6 2 1 4 4 and a , b are co-prime.
Hence a + b = 1 3 0 1 6 9 + 2 6 2 1 4 4 = 3 9 2 3 1 3 . ■
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 ( ( n − p 2 n ) + ⋯ + ( n 2 n ) + ⋯ + ( n + p 2 n ) ) 2 . When p = n , this becomes ( 2 2 n ) 2 = 4 2 n , 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.
Thanks! It does look a bit smaller now.
The solution is the same David Vreken. Calculate C ( 2 0 , k ) by Excel - first green line. Second green line is C ( 2 0 , k ) C ( 2 0 , 1 ), next lines C ( 2 0 , k ) C ( 2 0 , 2 ) , C ( 2 0 , k ) C ( 2 0 , 3 ) and so on. Sum of Blue numbers give way to answer.
Problem Loading...
Note Loading...
Set Loading...
We need the key binomial identities: a = 0 ∑ n ( a n ) 2 a = 0 ∑ n ( a n ) ( a + k n + k ) a = 0 ∑ n ( a n ) ( a + k n + k + 1 ) = ( n 2 n ) = ( n 2 n + k ) = ( n + 1 2 n + k + 1 ) for n , k ∈ N . We can prove these identities by considering the coefficient of X n in ( 1 + X ) 2 n = ( 1 + X ) n ( 1 + X ) n , the coefficient of X n in ( 1 + X ) 2 n + k = ( 1 + X ) n ( 1 + X ) n + k and the coefficient of X n + 1 in ( 1 + X ) 2 n + k + 1 = ( 1 + X ) n ( 1 + X ) n + k + 1 respectively.
If the robot starts at ( 0 , 0 ) , we want to know the probabiltiy of it landing on one of ( 0 , 0 ) , ( 2 , 0 ) , ( 0 , 2 ) , ( 0 , − 2 ) , ( 0 , − 2 ) , ( 1 , 1 ) , ( − 1 , 1 ) , ( − 1 , − 1 ) , ( 1 . − 1 ) after 20 moves.
The robot will land on ( 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 ∑ 1 0 a ! a ! ( 1 0 − a ) ! ( 1 0 − a ) ! 2 0 ! = a = 0 ∑ 1 0 ( 1 0 2 0 ) ( a 1 0 ) 2 = ( 1 0 2 0 ) 2 ways in which it can do this.
The robot will land on ( 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 ( a + 2 ) ! a ! ( 9 − a ) ! ( 9 − a ) ! 2 0 ! = a = 0 ∑ 9 ( a 9 ) ( a 1 1 ) ( 1 1 2 0 ) = ( 9 2 0 ) ( 1 1 2 0 ) ways in which it can do this.
The robot will land on ( 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 ( a + 1 ) ! a ! ( 1 0 − a ) ! ( 9 − a ) ! 2 0 ! = a = 0 ∑ 9 ( a 9 ) ( a + 1 1 1 ) ( 1 1 2 0 ) = ( 1 0 2 0 ) ( 1 1 2 0 ) 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 ) , the first coin must toss an equal number of heads and tails ( 1 0 of each) and the second coin must also toss an equal number of heads and tails. Thus there are a 1 = ( 1 0 2 0 ) 2 ways for this to happen.
If the robot is to land on ( 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 = ( 1 1 2 0 ) ( 1 1 2 0 ) ways for this to happen.
If the robot is to land on ( 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 = ( 1 1 2 0 ) ( 1 0 2 0 ) ways for this to happen.
Thus, by symmetry, there are a 1 + 4 a 2 + 4 a 3 = ( 1 0 ! ) 4 ( 9 ! ) 2 ( 1 1 ! ) 2 ( 2 0 ! ) 2 { ( 9 ! ) 2 ( 1 1 ! ) 2 + 4 ( 1 0 ! ) 4 + 4 ( 1 0 ! ) 2 9 ! 1 1 ! } = ( 1 0 ! ) 4 ( 9 ! ) 2 ( 1 1 ! ) 2 ( 2 0 ! ) 2 ( 2 ( 1 0 ! ) 2 + 9 ! 1 1 ! ) 2 = [ ( 1 0 ! ) 2 9 ! 1 1 ! 2 0 ! ( 2 ( 1 0 ! ) 2 + 9 ! 1 1 ! ) ] 2 = [ ( 1 0 2 0 ) 1 1 0 2 0 0 + 1 1 0 ] 2 = [ 1 1 3 1 ( 1 0 2 0 ) ] 2 ways in which the robot can end up within 2 units of its starting point, and so the probability that the robot ends up within 2 units of its starting point is 4 2 0 a 1 + 4 a 2 + 4 a 3 = [ 1 1 × 4 1 0 3 1 ( 1 0 2 0 ) ] 2 = b 2 a 2 where b a = 1 1 × 4 1 0 3 1 ( 1 0 2 0 ) = 2 6 2 1 4 4 1 3 0 1 6 9 making the answer 1 3 0 1 6 9 + 2 6 2 1 4 4 = 3 9 2 3 1 3 .