HELP WITH THIS QUIZ : )

Tal

New member
Joined
Dec 2, 2021
Messages
1
I have 3 lamps x, y, z. Initially, each of the lamps is turned off.
in each turn, i randomly choose one of the lamps and change its state.
Q : How many turns would it take ( on average ) until all of them are turned on ?

Coding the solution in python, got me 10 average turns.
I would to know the math way
 
I have 3 lamps x, y, z. Initially, each of the lamps is turned off.
in each turn, i randomly choose one of the lamps and change its state.
Q : How many turns would it take ( on average ) until all of them are turned on ?

Coding the solution in python, got me 10 average turns.
I would to know the math way

What have you learned that this quiz might be intended to test your ability to use?

I picture this as a random walk on the edges of a cube, from (0,0,0) to (1,1,1).
 
I wouldn’t imagine it being an even number since at least one is off by switching even number of times
 
It’s a simple permutation with repetition (like a dial combo-lock). If you are allowed to only 3 attempts, you would imagine there is a perm describing your action such as 3,1, 2 or 1,3,3. There are 27 perms (a combo-lock with three dials and each dial has number 1,2,3). To get all lights switched on within three switching, it would be the following perms: 123, 132, 213, 231, 312, 321, Hence 6/27 is the probability of all lights switching on when you have only 3 attempts. The rest 21/27 is probability that you would keep on going to do more than 3 attempts to be successful. And that simply means adding two dials on your combo-lock at the end for the 21 cases, or allow yourself 5 attempts for the unsuccessful perms in 3 attempts, which now to have a 21*9=189 perms to analyze. Other than 111,222,333, all other previous perms that didn’t switch on all three lights would include only 2 numbers and the future two switches must include a new number to switch them on. For example 122 must have a 3 in your future switch and 3 must be associated with the repeating number 2 in previous switch in order to switch all three lights on. Hence the future two switches would only have 3,2 or 2,3 to achieve the goal. There are 18 perms with one number repeating twice, and that makes 36 perms achieving the goal with 5 switchings. Now for the 111,222,333 scenario, they would also have total of 6 perms to switch on all three lights, for example 1,3 or 3,1 for 222. Add everything up you will have a 42/189 probability to switch on all three lights when performing 5 switching provided all 3 switchings not successful.

Interestingly, 6/27=2/9, 42/189=2/9. So without further analysis I presume whatever perms not turning on all three lights you will increase a chance of 2/9 of the 7/9 of the previously unsuccessful attempts by adding two more switching-actions.

So the formula should look like 2/9+7/9*2/9+(7/9)^2*2/9+••••(7/9)^n*2/9
 
Last edited:
And by the way the question asks I suppose you are more interested in the failing prob than the success prob. 7/9 is the the probability that you fail to turn on all three lights within 3 attempts and must attempt 5 or more times. 49/81 is you fail 5 attempts need 7 attempts. 343/729 is you fail 7 attempts and need 9 attempts and that so on. So by average do you mean 5*77.7%+7*60.5%+9*47.1%+11*36.6%…?
 
My mistake. If attempts 5 times and successful exactly at 5 the probability is 7/9*2/9, so I suppose the “average” is 3*22.2%+5*13.4%+7*10.5%+9*8.13%….
 
I would consider 2 states with 1 and 3 bulbs turned on respectively. After the first step we are in state 1 with probability 1.0. So here are the first two questions to figure out:
  1. What is the probability [imath]p[/imath] that starting in state 1 we are back in state 1 after exactly 2 steps?
  2. What is the probability [imath]q_n[/imath] that we reach state 3 after exactly [imath]2n+1[/imath] steps?
 
I would consider 2 states with 1 and 3 bulbs turned on respectively. After the first step we are in state 1 with probability 1.0. So here are the first two questions to figure out:
  1. What is the probability [imath]p[/imath] that starting in state 1 we are back in state 1 after exactly 2 steps?
  2. What is the probability [imath]q_n[/imath] that we reach state 3 after exactly [imath]2n+1[/imath] steps?
At the initial state the bulbs are at (0,0,0) state. By randomly run the program one turn there are three states it can achieve. (1,0,0),(0,1,0),(0,0,1) and if the selection is truly random there is 1/3 prob to achieve each state. For the 2nd turn, the program will make another random selection to make the bulbs to arrive at 9 states (some are the same): 000,110,101,110,000,011,101,011,000. And at the 3rd turn there are 27 states the program makes the bulbs, and apparently only 6 out of the 27 would be 111.

If each random selection is 1/3 prob, then each of the 27 states after 3 turns has a prob of 1/27 to arrive, and total prob would be 6 * 1/27 for 111 to appear after 3 turns.

The states don’t help much with calculating probability since apparently on the 2nd turn there are three occasions of 000, two occasions of 110,101,011 each. The probability of arriving at different states aren’t equal.
 
Last edited:
At the initial state the bulbs are at (0,0,0) state. By randomly run the program one turn there are three states it can achieve. (1,0,0),(0,1,0),(0,0,1) and if the selection is truly random there is 1/3 prob to achieve each state. For the 2nd turn, the program will make another random selection to make the bulbs to arrive at 9 states (some are the same): 000,110,101,110,000,011,101,011,000. And at the 3rd turn there are 27 states the program makes the bulbs, and apparently only 6 out of the 27 would be 111.

If each random selection is 1/3 prob, then each of the 27 states after 3 turns has a prob of 1/27 to arrive, and total prob would be 6 * 1/27 for 111 to appear after 3 turns.

The states don’t help much with calculating probability since apparently on the 2nd turn there are three occasions of 000, two occasions of 110,101,011 each. The probability of arriving at different states aren’t equal.
You seem to be talking about different approach, with 27 states while there are only 8 different possibilities. Does it help you with the answer?

My "state 1" includes all situations where one of the three bulbs is on, i.e. 100,010 or 001. And state 3 corresponds to 111. Since 111 can only be reached in an odd number of steps I look at at 2-step sequences starting from step 1, i.e, steps 1,3,5... because they keep the system in either state 1 or state 3. This approach allowed me to get to the answer by analytical methods.
 
You seem to be talking about different approach, with 27 states while there are only 8 different possibilities. Does it help you with the answer?

My "state 1" includes all situations where one of the three bulbs is on, i.e. 100,010 or 001. And state 3 corresponds to 111. Since 111 can only be reached in an odd number of steps I look at at 2-step sequences starting from step 1, i.e, steps 1,3,5... because they keep the system in either state 1 or state 3. This approach allowed me to get to the answer by analytical methods.
this is why I said the states don’t help with calculating possibilities. The program will look at the 8 states as a condition, which unless the states shows 111, all other 7 states don’t determine how the machine choose x,y,z other than keep on negating x,y,z at a random of 1 in 3 choices. So it is 7 states to keep going for the next two turns and 1 to halt the program. Yet you can’t argue that there is 7/8 probability to keep on going and 1/8 to stop. The number 8 has no logical existence in the formula.

If the program randomly chooses a state, then the number 8 would mean something. This problem is to randomly choose 1 out of 3 bulbs and negate its state, so the 8 states are simply an output.

If choosing 3 from 5 boys and 5 girls to line them up sequentially for a debate competition, you would have 8 formations as well in terms of gender. Yet it doesn’t help with calculating the probability.
 
While it is my impression that you don't like my suggestions I honestly don't understand why.
 
While it is my impression that you don't like my suggestions I honestly don't understand why.
Because I was in the same track and found it wrong. It doesn’t have anything to do with “like”. Once you get number 8 anywhere in this question you will get the probability messed up.

I am not trying to convince you but eventually I hope you will see there are a/27 prob in your a/8 state and b/27 prob in your b/8 state, which doesn’t depend on number 8 at all.
 
In simple terms, the states are being 0 lights on, 1 lights on, 2 lights on and all lights on. (Let’s call it state 0,1,2,3) The states with 0 lights on has 1 possibility, 1 lights on 3 possibilities, 2 lights on 3 possibilities and 3 lights on 1 possibility. State 1 can’t jump to state 3 and 0 can’t jump to 2. This I totally agree.

The problem is when you recognize these “possibilities”, only the 3 possibilities in state 1 are mutually exclusive while going from state 0 - there is only one way to arrive at each possibility respectively.

Another issue is while there is more than one way, to arrive at different possibilities the number of ways aren’t equal to one another. This can be seen as when going from state 1 to state 2 (or state 0), the three possibilities in state 1 has two ways each to enter state 2’s three possibilities respectively and one way each to return to state 0’s only one possibility.
 
Top