### Ants on a Cube

This was asked to me on Dec 1 in campus interviews of one of the companies.

We have a cube. An ant is on one of the corners. It moves randomly with equal probability in all the three directions. What is the expected number of steps to reach the opposite corner.

Note that the probability of the ant reaching the opposite corner in 2 steps is 0, in 3 steps is 6/27, in 4 steps is 0 and so on..

(I was able to solve it :D)

Update (11/12/09): Solution posted by Anshum (Jaadu, CSE, IITB) in comments!!

We have a cube. An ant is on one of the corners. It moves randomly with equal probability in all the three directions. What is the expected number of steps to reach the opposite corner.

Note that the probability of the ant reaching the opposite corner in 2 steps is 0, in 3 steps is 6/27, in 4 steps is 0 and so on..

(I was able to solve it :D)

Update (11/12/09): Solution posted by Anshum (Jaadu, CSE, IITB) in comments!!

Let the expected number of step required to go from (0,0,0) to (1,1,1) be E0.Also let expected number of step required to reach (1,1,1) from (0,0,1)(Or from (0,1,0) or from (1,0,0)) be E1.similarly expected number of step required to reach (1,1,1) from (0,1,1) (Or from (1,0,1) or from (1,1,0)) be E2.Then we can write:

ReplyDeleteE0=1/3(E1+E1+E1)+1

E1= 1/3*E0 + 2/3*E2 + 1

E2 = 2/3*E1 + 1

solving this we find E0 as 10.It is intersting to see that even though we can never reach opposite corner in even number of step,still number of expected step is even.

69/25?

ReplyDeleteyo jaadu... nice :)

ReplyDelete@asad.. Could you explain how did you get 69/25...

ReplyDeleteIn fact a simple sanity check that its wrong...

The best path is of length 3.. The worst might be of infinite length.. You cannot have expected length < 3 :)

This comment has been removed by a blog administrator.

ReplyDelete