Solution 1 (Slick Solution)
Perform the coordinate transformation (x,y)→(x+y,x−y). Then we can see that a movement up, right, left, or down in the old coordinates adds the vectors ⟨1,−1⟩, ⟨1,1⟩, ⟨−1,−1⟩, ⟨−1,1⟩ respectively. Moreover, the transformation takes the equation ∣y∣=∣x∣ to the union of the x and y axis. Exactly half of the moves go up in the new coordinates, and half of them go down. In order to end up on the x axis, we need to go up thrice and down thrice. The number of possible sequences of up and down moves is the number of permutations of UUUDDD, which is just (36)=20. The probability of any of these sequences happening is (21)6. Thus, the probability of ending on the x axis is 2620. Similarly, the probability of ending on the y axis is the same.
However, we overcount exactly one case: ending at (0,0). Since ending on the x axis and ending on the y axis are independent events, the probability of both is simply (2620)2=25625. Using PIE, the total probability is 6420+6420−25625=256135, giving an answer of 391.
~sampai7
Solution 2 (Casework)
We have 4 possible moves: U, D, R, and L. The total number of paths that could be taken is 46, or 4096. There are 4 possible cases that land along the line y=x: x,y=±1;x,y=±2;x,y=±3; or x=y=0. We will count the number of ways to end up at (1,1),(2,2), and (3,3), multiply them by 4 to account for the other quadrants, and add this to the number of ways to end up at (0,0).
-
Case 1: The token ends at (3,3). In order for the token to end up here, it must have had 3 right moves, and 3 up moves. In other words, the total number of ways to get here is the ways to rearrange the letters in the sequence RRRUUU, which is (36)=20.
-
Case 2: The token ends at (2,2). In order for the token to end up here, it could have had 2 up moves, 3 right moves, and 1 left move; or 2 right moves, 3 up moves, and 1 down move. Thus, the total number of ways to get here is sum of the ways to rearrange the letters in the sequences RRRLUU and UUUDRR, both of which are (16)(25)=60, for a total of 120 possibilities.
-
Case 3: The token ends at (1,1). In order for the token to end up here, it could have had:
- 1 right move, 3 up moves, and 2 down moves. In this case, the number of ways to rearrange the letters in the sequence RUUUDD is (16)(25)=60.
- 1 up move, 3 right moves, and 2 left moves. In this case, the number of ways to rearrange the letters in the sequence URRRLL is (16)(25)=60.
- 2 right moves, 1 left move, 2 up moves, and 1 down move. In this case, the number of ways to rearrange the letters in the sequence UUDRRL is (16)(15)(24)=180.
Thus, the total number of ways to end up at (1,1) is 300.
- Case 4: The token ends at (0,0). In order for the token to end up here, it could have had:
- 3 right moves and 3 left moves. In this case, the number of ways to rearrange the letters in the sequence RRRLLL is (36)=20.
- 3 up moves and 3 down moves. In this case, the number of ways to rearrange the letters in the sequence UUUDDD is (36)=20.
- 1 right move, 1 left move, 2 up moves, and 2 down moves. In this case, the number of ways to rearrange the letters in the sequence RLUUDD is (16)(15)(24)=180.
- 1 up move, 1 down move, 2 right moves, and 2 left moves. In this case, the number of ways to rearrange the letters in the sequence RRLLUD is (16)(15)(24)=180.
Thus, the total number of ways to end up at (0,0) is 400.
Adding these cases together, we get that the total number of ways to end up on y=x is 4(20+120+300)+400=2160. Thus, our probability is 40962160. When this fraction is fully reduced, it is 256135, so our answer is 135+256=391.
Solution 3 (Casework)
We split this into cases by making a chart. In each row, the entries (±1) before the dividing line represent the right or left steps (without regard to order), and the entries after the dividing line represent the up or down steps (again, without regard to order). This table only represents the cases where the ending position (x,y) satisfies x=y.
\multicolumn5cR(+)L(−)+1+1+1−1+1+1+1+1+1+1∣\multicolumn5cU(+)D(−)+1+1−1−1+1+1−1+1+1+1+1−1−1−1+1−1−1+1−1+1∣∣∣∣+1+1+1−1−1−1−1−1−1−1∣∣∣+1+1−1−1+1+1−1−1−1−1∣∣+1−1−1−1+1−1−1+1−1−1∣(×2 for symmetry by swapping R−L and U−D)(×2 symmetry)(×2 symmetry)
Note that to account for the cases when x=−y, we can simply multiply the U−D steps by −1, so for example, the first row would become
+1+1+1 ∣ −1−1−1.
Therefore, we must multiply the number of possibilities in each case by 2, except for when x=y=0.
Now, we compute the number of possibilities for each case. In particular, we must compute the number of RLUD words, where R represents +1 to the left of ∣, L represents −1 to the left of ∣, U represents +1 to the right of ∣, and D represents −1 to the right of ∣. Using multinomials, we compute the following numbers of possibilities for each case.
(36)⋅2+2!2!6!⋅2+2!2!6!⋅2+(36)⋅2=2(20+180+180+20)=800
3!2!6!⋅2+2!2!6!+3!2!6!⋅2=120+180+120=420 (×2 for symmetry)
3!2!6!⋅2+3!2!6!⋅2=120+120=240 (×2 for symmetry)
(36)=20 (×2 for symmetry)
Thus, there are 800+840+480+40=2160 possibilities where ∣x∣=∣y∣. Because there are 46 total possibilities, the probability is 462160=256135, so the answer is 391.
Solution 4 (States)
Denote (x,y)n the probability that starting from point (x,y), the token reaches a point on the graph of ∣y∣=∣x∣ in exactly n moves. The problem asks us to find (0,0)6. We start by breaking this down:
(0,0)6=41⋅((0,1)5+(0,−1)5+(1,0)5+(−1,0)5)
Notice that by symmetry, (0,1)5=(0,−1)5=(1,0)5=(−1,0)5, so the equation simplifies to
(0,0)6=(0,1)5
We now expand (0,1)5.
(0,1)5=41⋅((0,0)4+(0,2)4+2(1,1)4)
First, we find (0,0)4.
(0,0)4=(0,1)3
(0,1)3=41⋅((0,0)2+(0,2)2+2(1,1)2)
At this point, we can just count the possibilities to find (0,0)2=43, (0,2)2=167, and (1,1)2=85. Therefore,
(0,1)3=41⋅(43+167+2⋅85)
(0,1)3=6439
Next, we find (0,2)4.
(0,2)4=41⋅((0,1)3+(0,3)3+2(1,2)3)
We already calculated (0,1)3, so we just need to find (0,3)3 and (1,2)3
(0,3)3=41⋅((0,2)2+(0,4)2+2(1,3)2)
(0,3)3=41⋅(167+0+2⋅41)
(0,3)3=6415
(1,2)3=41⋅((1,3)2+(1,1)2+(0,2)2+(2,2)2)
(1,2)3=41⋅(41+85+167+21)
(1,2)3=6429
Therefore,
(0,2)4=41⋅(6439+6415+2⋅6429)
(0,2)4=167
Finally, we find (1,1)4.
(1,1)4=21⋅((0,1)3+(1,2)3)
(1,1)4=21⋅(6439+6429)
(1,1)4=3217
Putting it all together,
(0,0)6=(0,1)5=41⋅(6439+167+2⋅3217)
(0,0)6=256135
Thus, the answer is 135+256=391.
Solution 5 (Generating Functions)
For any point (x,y) on the coordinate plane, we can represent it as the term axby. Then, moving right is equivalent to multiplying by a, moving left is equivalent to multiplying by 1/a, and similarly for up/down with b and 1/b. Because, on every move, the possibilities are these four directions, and each is equally likely, each move can be represented by multiplying by a+a1+b+b1. Thus, the possibilities after 6 moves are the same as the coefficients of (a+a1+b+b1)6. By symmetry, we just need to find the number of ways for the token to reach (0,0),(1,1),(2,2), and (3,3). By the multinomial theorem, the coefficient of a3b3 is (3,36)=20. Similarly, the coefficient of a2b2 is 2(3,2,16)=120. The coefficient of ab is (2,2,1,16)+2(3,2,16)=300. Finally, the constant term is 2(2,2,1,16)+2(3,36)=400. Because the total number of possibilities is 46, the probability is
464(20+120+300)+400=445+30+75+25=256135,
and the answer is 391. --brainiacmaniac31