Probability problem in hexagon

In summary, the conversation discusses a problem involving 6 bugs standing on the 6 vertices of a hexagon and moving towards a different vertex at the same speed. The question is how many possibilities are there for the bugs to move such that they never meet at the same place and time. The conversation includes various attempts at solving the problem and enlists the help of a computer program to examine all possible derangements for collisions. Ultimately, it is determined that there are 58 derangements with no collisions, and 7 different types of derangements can be obtained by reversing the arrows or rotating the hexagon. A C program is provided to analyze all possible derangements for collisions.
  • #1
leuler
3
0
So say I have 6 bugs standing on the 6 vertices of a hexagon, one per vertex. And say they each pick a vertex that they are not currently on, and starts moving in a straight line towards that vertex at the same speed. So my question is how many possibilities are there for the bugs to move to the vertices such that none of them are ever in the same place at the same time?
 
Mathematics news on Phys.org
  • #2
Can you post what you have tried or what your thoughts are on how to begin so our helpers can see where you are stuck and how best to help you?
 
  • #3
Well, I know that if two bugs are in the same place, then they are the same distance away from their starting vertices. However, I have trouble listing out all of the possible combinations. There are 9 diagonals of a regular hexagon.
 
  • #4
Ok, I think I might know how to do this now. There are 265 possible ways that the bugs could move to a different vertex, and 210 possible ways that the bugs meet at the center of the hexagon, and 168 ways that they could meet at a place that is not at the center. After this, you have to add the number of ways that the bugs do both, which turns out to be 240, so the total number of ways is 265-240-168+240=127. Can someone check this? My method was to represent each vertex arrangement as a permutation.
 
  • #5
Hi,
This is an interesting fun problem. However, the only number of yours that I understand is the 265 derangements of 6 objects. My counting skills are not up to solving the problem by hand, so I enlisted the aid of the computer.

First observation is that if a given derangement d contains a transposition (d=j and d[j]=i for some i and j), then the bugs meet at the midpoint of of the line connecting vertex i and j. So this eliminates 105 of the derangements, leaving only 160 possibilities. So "just" examine each of these 160 for collisions.

The first attachment restates the problem and shows the main idea in detecting collisions:

2lb2yde.png

There are 58 derangements with no collisions. The next attachment shows these. There are 7 different types. In each type, you can get another no collision derangement of the same type by reversing the arrows or a suitable rotation.

1zf29sn.png

Finally, here's the C program that examines each possible derangement for collisions:

Code:
#include <stdio.h>
#include <stdlib.h>
#define MAX (20)
#define Swap(x,y,t) t=x; x=y; y=t

void Perms1(int p[],int n,int m);
void Cycle(int p[],int n);

int noCollisions=0;
FILE *ofp;

int main(void){
    int p[MAX];
    int i,n=6;
    ofp=fopen("hexagondata.txt","w");
    for (i=0;i<n;p[i]=i,i++);
    fprintf(ofp,"Derangements with no collisions.\n");
    Perms1(p,n,n);
    fclose(ofp);
    return(0);
}

void Cycle(int p[],int n)/* Outputs p in both linear and cyclic form */{
    int a[MAX];
    int i,j,k;
    fprintf(ofp,"%d.  ",noCollisions);
    for (i=0;i<n;i++) {
        a[i]=p[i];
        fprintf(ofp," %d",a[i]);
    }
    fprintf(ofp," --- ");
    do {
        for (i=0;i<n && a[i]==-1;i++);
        if (i==n) {
            break;
        }
        if (i!=n-1 && a[i]!=i) {
            fprintf(ofp,"( %d",i);
            j=a[i];
            a[i]=-1;
            do {
                fprintf(ofp," %d",j);
                k=j;
                j=a[j];
                a[k]=-1;
            }
            while (j!=i);
            fprintf(ofp," )");
        }
        else
            a[i]=-1;
    }
    while (i!=n-1);
    fprintf(ofp,"\n");
}

int collision(int p[]) {
    int i,j;
    int indices[6];
    // does p contain a transposition?
    for (i=0;i<6;i++) {
        if (p[p[i]]==i) {
            return(1);
        }
    }
    // now check each vertex for a collision
    for (i=0;i<6;i++) {
        for (j=0;j<6;j++) {
            indices[j]=(i+j)%6;
        }
        if (p[i]==indices[2]) {
            if (p[indices[1]]==indices[5] || p[indices[3]]==indices[1]) {
                return(1);
            }
        }
        if (p[i]==indices[3]) {
            if (p[indices[1]]==indices[4] || p[indices[4]]==indices[1]
                    || p[indices[2]]==indices[5] || p[indices[5]]==indices[2]) {
                return(1);
            }
        }
        if (p[i]==indices[4]) {
            if (p[indices[5]]==indices[1] || p[indices[3]]==indices[5]) {
                return(1);
            }
        }
    }
    return(0);
}
/* Standard recursive generation of all permutations.  This is modified to process only
derangements.  For such a derangement, if there are no collisions, the derangement
is printed via function cycle.
*/

void Perms1(int p[],int n, int m){
    int i,j;
    int temp;
    if (n==0) {
        for (j=0;j<m;j++) {
            if (p[j]==j) {
                break;
            }
        }
        if (j==m) { // p is a derangement
            if (!collision(p)) {
                noCollisions++;
                Cycle(p,m);
            }
        }
    }
    else {
        Perms1(p,n-1,m);
        for (i=n-2;i>=0;i--) {
            Swap(p[i],p[n-1],temp);
            Perms1(p,n-1,m);
            Swap(p[i],p[n-1],temp);
        }
    }
}

Since the numbers are so "small" for a computer, the above program runs very quickly, about 5 100th's of a second on my PC.
 
  • #6
Addendum to my previous post. I wondered how the bugs would fare on bigger polygons. I tweaked the program of my earlier post and obtained the following:

2w57mz7.png


Obviously the numbers are starting to get pretty big. The strategy of examining each derangement just is not viable for much bigger polygons. For a regular 30 sided polygon, I have no idea how to proceed.

If anyone is interested, I'll post my tweaked program.
 

Related to Probability problem in hexagon

1. What is the probability of choosing a specific side of a hexagon?

The probability of choosing a specific side of a hexagon is 1/6 or approximately 16.67%. This is because a hexagon has 6 sides and each side has an equal chance of being chosen.

2. What is the probability of rolling a certain number on a hexagonal die?

The probability of rolling a certain number on a hexagonal die is 1/6 or approximately 16.67%. This is because a hexagonal die has 6 sides and each side has an equal chance of being rolled.

3. How do you calculate the probability of an event occurring in a hexagon?

To calculate the probability of an event occurring in a hexagon, you would divide the number of favorable outcomes by the total number of possible outcomes. For example, if you want to find the probability of landing on a specific side of a hexagon, you would divide 1 (the number of favorable outcomes) by 6 (the total number of sides).

4. What is the difference between theoretical probability and experimental probability in a hexagon?

Theoretical probability is the expected probability of an event occurring based on mathematical calculations, while experimental probability is the actual probability of an event occurring based on repeated trials. In a hexagon, theoretical probability would be the same for all sides (1/6), while experimental probability may vary depending on the outcomes of the trials.

5. Can the probability of an event in a hexagon be greater than 1?

No, the probability of an event in a hexagon cannot be greater than 1. This is because probability is a measure of how likely an event is to occur, and it cannot exceed 100% or 1 in decimal form. Therefore, the highest probability in a hexagon would be 1/6 or approximately 16.67%.

Similar threads

Replies
2
Views
324
Replies
30
Views
4K
  • Introductory Physics Homework Help
Replies
12
Views
1K
Replies
7
Views
2K
  • Nuclear Engineering
Replies
6
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
21
Views
4K
  • Nuclear Engineering
Replies
1
Views
913
Replies
1
Views
1K
Replies
9
Views
1K
Replies
9
Views
2K
Back
Top