# Need help with basic probability scenario (not hw)

#### rw90

##### New Member
Rephrasing the scenario into a word problem for the sake of simplicity. I hope it doesn't get convoluted, but then again explaining the actual mechanic might not help much either.

There are five switches laid in a row numbered one through five. Each switch is turned on in the order that they are laid.

The first switch has a 100% chance to turn on. The second switch has a 50% chance to turn on. The third switch's chance to turn on is based upon the result of the second switch. If the second switch did not turn on, then the third switch now has a 50% chance to turn on. If the second switch did turn on however, the third switch now only has a 25% chance to turn on.

If neither the second or third switches turn on, then the fourth switch now has a 50% chance to turn on. If the second switch did not turn on, but the third switch did however, the fourth switch now has a 25% chance to turn on. Repeat for switch 5, etc.

Additionally, only a maximum of three switches (including the first) can turn on. What are each switch's chance of turning on when they are activated individually in numerical order?
I tried searching but I don't even know what to search for. If someone could help, or at least point me in the right direction I'd appreciate it.

Last edited:

#### JesseJames

##### New Member
1 = 100%
2 = 50%
3 = 50% x 50% to turn on if 2 does not turn on, 50% x 25% to turn on if 2 does turn on.
4 = 50% x 50% x 50% to turn on if 2 and 3 do not turn on, 50% x 25% x 25% to turn on if 2 is off and 3 is on.
5 = 50% x 50% x 50% x 50% to turn on if 2, 3 and 4 do not turn on, 50% x 25% x 25% 25% if 2, 3 and 4 are on.

See how this works now? Change the equation based on whether a switch is off or on. I'm fairly sure this is right, anyone got a second opinion though?

#### rw90

##### New Member
1 = 100%
2 = 50%
3 = 50% x 50% to turn on if 2 does not turn on, 50% x 25% to turn on if 2 does turn on.
4 = 50% x 50% x 50% to turn on if 2 and 3 do not turn on, 50% x 25% x 25% to turn on if 2 is off and 3 is on.
5 = 50% x 50% x 50% x 50% to turn on if 2, 3 and 4 do not turn on, 50% x 25% x 25% 25% if 2, 3 and 4 are on.

See how this works now? Change the equation based on whether a switch is off or on. I'm fairly sure this is right, anyone got a second opinion though?
Thanks for the reply. I see how it works to an extent, but could you then represent each switch with a single probability that accounts for the previous switches?

#### Dason

What do you mean by a single probability? The events aren't all independent. Toss in the fact that out of switches 2-4 a maximum of two of them actually can turn on a light and things aren't too nice. There are really only 11 possible outcomes you need to consider though - let Y indicate that the light is on and N be that the light is off.

YNNNN (First light is on - the rest are off)
YYNNN (First and second lights are one - the rest are off)
YNYNN (so on...)
YNNYN
YNNNY
YYYNN
YYNYN
YYNNY
YNYYN
YNYNY
YNNYY

From your information you can figure out the probability of each of these occuring. Note that since these are the only 11 possibilities (based on the fact that light 1 always turns on and there can only be a maximum of 3 lights that are on) that the probabilities that each of these occur should sum to 1. If they don't then the information provided isn't truly correct.

#### rw90

##### New Member
What do you mean by a single probability? The events aren't all independent. Toss in the fact that out of switches 2-4 a maximum of two of them actually can turn on a light and things aren't too nice. There are really only 11 possible outcomes you need to consider though - let Y indicate that the light is on and N be that the light is off.

YNNNN (First light is on - the rest are off)
YYNNN (First and second lights are one - the rest are off)
YNYNN (so on...)
YNNYN
YNNNY
YYYNN
YYNYN
YYNNY
YNYYN
YNYNY
YNNYY

From your information you can figure out the probability of each of these occuring. Note that since these are the only 11 possibilities (based on the fact that light 1 always turns on and there can only be a maximum of 3 lights that are on) that the probabilities that each of these occur should sum to 1. If they don't then the information provided isn't truly correct.
Sorry, it's been a while since I did probability in HS, so I'm probably not using proper terminology. What I mean is, if you were to perform some number of experiments and record how often each light turns on, you'd come up with an average percent chance that each light would turn on based on the results, right? How would you calculate that number mathematically? Heres what I originally tried before I made this topic:

Switch 1: 100%
Switch 2: 50%
Switch 3: (50+25)/2=37.5%..?
Switch 4: (37.5+25)/2=31.25%..?

Trying to find the single percent chance each switch has to activate on average. I know with certainty switch 1 is always 100%, and switch 2 is always 50%, the other 3 is where I'm stuck. Not sure if average is the correct word.

#### Dason

That's what I was trying to explain. There are only 11 possible outcomes based on the criteria you gave. If I give you a sequence you should be able to figure out the probability of that sequence occurring right?

So if we do that for each of the 11 sequences all of those probabilities should sum to 1. Then if you want to find the probability that the third switch is on you just sum the probabilities for each of the sequences where the third switch is on.

If you've ever used R here is some code that does all of that for you.

Code:
# All outcomes with no restrictions
x <- c(T, F)
o <- expand.grid(x, x, x, x, x)
# Only care about ones that have TRUE as first
o <- o[o[,1], ]
# Only care about ones that have <=3 lights on
o <- o[apply(o, 1, sum) <= 3,]

# Probabilities for each outcome
ps <- c(
1 * .5 *  .5 *  .5 * .25,
1 * .5 *  .5 * .75 * .25,
1 * .5 * .75 * .75 * .25,
1 * .5 *  .5 *  .5 *  .5,
1 * .5 *  .5 * .25 *   1,
1 * .5 * .75 * .25 *   1,
1 * .5 *  .5 *  .5 * .75,
1 * .5 * .25 *   1 *   1,
1 * .5 *  .5 * .75 * .75,
1 * .5 * .75 * .75 * .75,
1 * .5 *  .5 *  .5 *  .5)

# Should sum to 1
sum(ps)

# Find marginal probability for each position
apply(o, 2, function(x){sum(ps[x])})

#### rw90

##### New Member
Never used R before, but I downloaded, installed, and ran the script you made for me, and it returned:

Code:
     Var1      Var2      Var3      Var4      Var5
1.0000000 0.5000000 0.3750000 0.2812500 0.2109375
Those are the percent chances that each switch ultimately has to turn on? To be honest, even as much as you had helped me along, I probably would not have figured that out on my own from where you had left it without the script. For the sake of comprehension, where did the .75's come from? Thanks a lot for the help.

Last edited:

#### Dason

Well at any given point if the probability a switch will turn the light on is .25 then that means that the probability it won't turn on is .75.

#### rw90

##### New Member
Well at any given point if the probability a switch will turn the light on is .25 then that means that the probability it won't turn on is .75.
Oh, now it makes a lot more sense. Thanks alot for the help.

#### rw90

##### New Member
Quick bump, I just wanted to check if I was doing this right:

http://imgur.com/32Gygdf

I changed the values in the scenario to 100% on first activation, 60% for next, 35% for next, etc, then added the respective probabilities to get the ultimate probability each switch had to activate. Is this correct?