This one could drive you buggy .....

Suppose 8 8 bugs are positioned at the 8 8 corners of a unit cube, (one bug per corner). Each bug, simultaneously, randomly and independently, chooses one of the 3 3 edges adjacent to its corner to travel on, and then does so until it reaches the next corner. (All the bugs travel at the same constant rate.)

The probability that none of the bugs meets any other bug in this process is a b \dfrac{a}{b} , where a a and b b are positive coprime integers. Find a + b a + b .


The answer is 2195.

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.

3 solutions

First, since each of the bugs has 3 3 edges it can travel along there are 3 8 = 6561 3^{8} = 6561 possible patterns of motion for the 8 8 bugs.

For the bugs not to meet, there are two possibilities: (i) the pattern of all their moves combined forms two closed loops on opposite sides of the cube, and (ii) the pattern of all their moves combined forms a loop around the cube that visits each corner exactly once.

In case (i), there are 3 3 pairs of opposite sides, and each loop can go in one of two directions. This gives us 3 2 2 = 12 3*2*2 = 12 distinct patterns of motion.

In case (ii), we first note that at each corner exactly two adjacent edges must be on the loop, one leading to the corner and one leading away. If two such edges share a side of the cube, a third edge of that side must also be part of the loop in order for the loop to go through the last corner of that side before exiting that side. This forms a U U -shape within the loop. (Note that the case where a 4 4 -th edge of a side is also part of the pattern of motion results in case (i), which we've already dealt with.)

Now to count these loops, we start by focussing on one corner. Two of the three adjacent edges must be part of the loop, which can be chosen in ( 3 2 ) = 3 \binom{3}{2} = 3 ways. These two edges share a side, so as per the above discussion one of the remaining two edges must also be on the loop; once this choice is made, the rest of the loop can only be completed in one way. So there are 3 2 = 6 3*2 = 6 possible loop paths, each of which can be traversed in one of two directions, resulting in a total of 6 2 = 12 6*2 = 12 distinct patterns of motion.

Thus we end up with a desired probability of 12 + 12 6561 = 8 2187 \dfrac{12 + 12}{6561} = \dfrac{8}{2187} . This means that a = 8 , b = 2187 a = 8, b = 2187 and a + b = 2195 a + b = \boxed{2195} .

I got 12/6561... :-(

Satyen Nabar - 6 years, 8 months ago

Log in to reply

Close. :) I guess you missed one of the cases I outlined in my solution. It took me a long time to visualize the solution to this problem, but I think I have the right answer. I'm trying to visualize bugs moving on other Platonic solids now, so I may post similar questions in the future.

Brian Charlesworth - 6 years, 8 months ago

What about the case where the bugs traverse 3 points on one side (say the top, going clockwise from Top Front L corner to Top Back L corner to Top Back R corner), then leave that side and drop down to the bottom (Bottom Back R corner), go the other way (counter clockwise) to the Bottom Back L corner, Bottom Front L Corner, Bottom Front R corner, then go up to the Top Front R corner? Covers all corners, seems to add another 12 paths. Then there would be 36/6561 = 12/2187.

Peter Roche - 3 years, 8 months ago

Log in to reply

Oh, never mind, I see: the bottom half makes a "U", so it reduces to one of the previous ones run backward.

Peter Roche - 3 years, 8 months ago

lol i used a tissue box to help visualize

Edwin Ma [STUDENT] - 7 months, 2 weeks ago

The best way to solve a combinatorics puzzle is to simulate it.

Label the vertices a, b, c, d, e, f, g and the edges 1 to 8 and create a directed graph like this.

Imgur Imgur

When a bug traverses an edge in the opposite direction, it's sign is taken to be negative. For example a path from D to C is -6

Now, let's make a list of all the 8-tuples which represent all possible ways the ants could go

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
paths = []
for a in [1,2,3]:
     for b in [-3,4,5]:
             for c in [6,-4,7]:
                     for d in [-1,-6,8]:
                             for e in [-2,9,10]:
                                     for f in [-8,-10,11]:
                                             for g in [-11,-7,12]:
                                                     for h in [-9,-12,-5]:
                                                             paths.append([a,b,c,d,e,f,g,h])

Now, every valid path must not have two ants travelling in the same edge, i.e, must not contain a edge and it's negative. Also, it must not contain two edges that lead to the same vertex

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
def good_path(x):
     for i in x:
             if -i in x: return False
     if not (-1 in x)^(-2 in x)^(-3 in x): return False
     if not (3 in x)^(-4 in x)^(-5 in x): return False
     if not (4 in x)^(-6 in x)^(-7 in x): return False
     if not (1 in x)^(6 in x)^(-8 in x): return False
     if not (2 in x)^(-9 in x)^(-10 in x): return False
     if not (10 in x)^(8 in x)^(-11 in x): return False
     if not (11 in x)^(7 in x)^(-12 in x): return False
     if not (9 in x)^(5 in x)^(12 in x): return False
     return True

We are ready!

1
2
good_paths=filter(good_path,paths)
print len(good_paths),len(paths)

So, there are 24 valid possibilities out of all 3 8 3^8 possibilities.

Thus required probability is 24 3 8 \boxed{\frac{24}{3^8}}

Sorry in lieu of a figure this is going to be long winded, but here we go -

The condition of Bugs not meeting can be viewed as 'find one or more uni-cursory paths to cover all vertices' Next consider the 'number of faces' taking part in these paths.

1.ONE FACE: If we take one face, 4 bugs take part and just move in a CW or CCW 'circle'. Then we need remaining 4 bugs to do the same on the opposite face. Giving 4 combinations (CW-CW, CW-CCW etc.) for one opposing face pair. Since there are 3 such pairs so in all 4 x 3 = 12 ways. 2. TWO FACES: If we take a loops with 2 faces, they will have to be adjacent, roping in 6 bugs. But then the remaining 2 will have to swap places along the edge they share, thereby meeting. So no solution here. 3. THREE FACES: 3.a. Three faces forming a 'C' clamp, gives us a uni-cursory path around the cube. Imagine instead of starting simultaneously, the bugs play 'tag' the next one to get him started. There are 6 ways we can 'C-clamp' the cube and then two direction to travel its edges. So another 6 x 2 = 12 ways! 3.b. Three faces forming a 'corner' isolate and leave one vertex high and dry. So no possibility of a solution here.

Ujjwal Rane - 6 years, 8 months ago

Log in to reply

Nice! Post it as a solution

Agnishom Chattopadhyay - 6 years, 8 months ago

If I may give another way to program it in python, avoiding nested loops and so easily scalable:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# find if an array has same values, i.e. two bugs coming to same place
def hasDuplicate(array):
        array = array[:] # make a copy to preserve initial array
        array.sort() # comparing is much easier if array is sorted
        for k in xrange(len(array)-1):
                if array[k] == array[k+1]:
                        return True
        return False

# find if array[i]=j and array[j]=i, which means A goes to B and B goes to A
def hasCrossing(array):
        for k in xrange(len(array) - 1): # last one doesn't need checking
                # if destination of the destination of k is k, then there is a crossing
                if array[array[k]] == k:
                        return True
        return False

connections = [ [1,3,4], [0,2,5], [1,3,6], [0,2,7], [0,5,7], [1,4,6], [2,5,7], [3,4,6]  ]

numberOfWays = 0 

# ternary numbers from 00'000'000 to 22'222'222, representing index of choosen paths
for n in xrange(3**8):
        # convert n to ternary digits and find destinations
        digits = [ ((n/(3**k))%3) for k in xrange(8) ]
        destinations = [ connections[k][digits[k]] for k in xrange(8) ]

        # check and count when everything goes better than expected
        if not (hasDuplicate(destinations) or hasCrossing(destinations)):
                numberOfWays += 1

print numberOfWays

Laurent Shorts - 5 years, 1 month ago

Log in to reply

You are indeed right. Nesting too many loops is not a good idea.

Thanks for your solution.

Agnishom Chattopadhyay - 5 years, 1 month ago
Lovro Cupic
Feb 3, 2018

Let 1,2,3,4,1',2',3',4' be the bugs. There are 12 different 8-length cycles describing bug movements (such as 1-2-3-4-4'-3'-2'-1' - read: bug 1 goes towards bug 2, bug 2 towards bug 3, etc, bug 1' goes towards bug 1) and 12 different pairs of cycles of length 4 (such as 1-2-3-4, 1'-2'-3'-4') which gives bugs 24 ways to cross edges without meeting. We can pick two opposite sides of the cube in 3 ways and rotate bugs on each side clockwise or counterclockwise, so there are 3 2 2 = 12 3*2*2=12 (non ordered) pairs of 4-length cycles. It's not difficult to write down 12 8-length cycles if we draw our cube like a planar graph: Since each bug can choose between 3 adjacent vertices, there are 3 8 3^8 permutations. Therefore, probability is 24 / 3 8 = 8 / 3 7 24/3^8 = 8/3^7 and the answer is 8 + 3 7 = 2195 8+3^7 = 2195 .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...