ConvinceMePlease Posted December 14, 2016 Posted December 14, 2016 (edited) Hello guys, I created problem that I couldnt solve: lets say we have WHITE OR BLACK balls are randomly put in series (or line, or queue). when we put them, chance will be 50% white or 50% black ball will be put. However, we cannot put 2 black balls consecutively, we can only put 2 white consecutively so, if we tried this 4 times putting 2 in series, we will end up with 4 probabilities W W W B B W B B but forth one will be ommitted and reduce to B W because we restricted that no 2 consecutive black balls, so we will end up with W W W B B W B W The problem is, if we keep putting balls following these rules, how much will be ratio of B/Total converging to? Also, lets say that drawing Black is lets say 25% and not 50% How would we solve this convergence problem? also, lets say that we put another restriction, that whenever we draw a BLACK ball, the next 2 balls must be white I.e. anything like this ( B B B B) will be reduced to (B W W B) Again, How will it converge in this case? when we keep putting the balls, what is this fraction getting closer to? This isnt really my homework, I just wanna solve this problem I find it intresting xD what I did so far is I started the series (for case when restriction is: when black ball is drawn, next ball cannot be black, 75%chance for what, 25% for black (but 0% if previous ball is balck ): if 1 ball is there, there is no restriction so for 4 trials we will get 1 black ball (25%) For 2 elements in the series and for 16 trials we will ommit BB probability and make it BW, so we lost 1 black ball (1/8 difference) B B > BW B W W B W W i.e. in 16 trials we ended up with 7 balls (instead of 8 balls if there was no restriction) and for 3 elements, we try 64 times, and we ommit the following results B B B will become B W B and B B W will become B W W and W B B will become W B W instead of ending up with 48 black balls we ended up with 41 black balls, losing 7 black ones (7/48 ) and for 4 elements in the series, we will ommit B B B B will become B W B W W B B B will become W B W B etc etc fo all values, and we will end up 216 black balls instead of 256 if we use common denominator for amount of lost black balls because of restriction compared to theoritical amount if there were no restrictions, it wil be 1 series 0/ 96 2 series 12 / 96 3 series 14 / 96 4 series 15/96 clearly to me it is converging somewhere, I just cant get there :S Edited December 14, 2016 by ConvinceMePlease
Prometheus Posted December 14, 2016 Posted December 14, 2016 If i understand the first problem we can see that we have a 0.5 probability of drawing a W and a 0.5 probability of drawing a B. But as we know a B cannot be followed by a B then this latter is saying there is a 0.5 probability of drawing a BW. So for every B there is also an additional W plus the other (random) Ws in the series. Intuitively we can see that this converges to 1/3 in the long run (there should be twice the number of Ws as Bs). To do it more thoroughly we have to be careful what we mean about the convergence of a series of random variables, there are several types. I assumed you meant almost surely?
ConvinceMePlease Posted December 15, 2016 Author Posted December 15, 2016 intuitively? *_* yea I think i kind of get it. here is my thought every B W is followed by ither B or W half of them will be will be B W W the other half will be B W B and every W will be folowed by B or W so half will be W W and half will be W B all of the elemst we have now are 6 X W + 3 B is that the solution? did I get it correctly? there is one confusing part is that the elemnt W B cannot be followed by BWW nor by BWB :S so I am not sure my solution is absolutely correct, will this not have side effect? what I meant is "what is the ratio we are getting closer and closer to but not quite" so yes almost EDIT: actually never mind, i think i get it we dont have a B element, we only have a BW element. Chance of BW = Chance of W so BW W BW W BW W W BW something like this, such that the chance of BW = chance of W I get it, thanks! Number of B = 0.5, Number of W = 0.5 (from BW) + 0.5 (from W element)=1.0 Ratio B = 0.5/1.5 = 1/3 Ive done the math xD Thanks mate EDIT: about the 25% so basically we do the same logic as previous one? every W followed by either BW or W W BW W W and every BW is followed by either BW or by W Chance of BW = 25%, chance of W = 75% Total Number of W = 100, Number of B = 25 ratio B = 25/125 = 1/5 = 20% Problem Solved! Thanks xD For the last case, it will be 2 elements B W W and W so it will B/Total = 25/150 = 1/6 = 16.6%
_Rick_ Posted December 15, 2016 Posted December 15, 2016 (edited) You should quickly realise that and string will look something like BWWWBWBWBWWW Simply put a string of Ws with single intermittent Bs If we treat each section as B followed by some number of Ws we get sections such as BWWW BW BW BWWW Now if we just find the average number of Ws in each section we can find a ratio. The chance of finding BW is 100%, BWW 75% and BWWW 56.25% ect.. This can be reduced to the expected value of getting N Ws in a row, as there's a 1/4 chance of getting a black it should take 4 tries until we get one. Therefore the average string should be: BW (100%) + WWWW = BWWWWW So on average we get 1 B for every 5 Ws, 1/5 chance If you'd like any more proof than this I wrote a quick piece of python code to verify this which usually gives values of about 0.2 import random string = [] for p in range(100000): if random.randint(0,3) != 0: string += ["W"] elif list(string)[-1] == "W" or string == 0: string += ["B"] print(string.count("B")/len(string)) Edited December 15, 2016 by _Rick_
Prometheus Posted December 15, 2016 Posted December 15, 2016 The easy and dirty way to generalise this would be to consider [latex]\frac{p}{p+1}[/latex], where p is the probability of getting a B.
ConvinceMePlease Posted December 15, 2016 Author Posted December 15, 2016 (edited) yea xD Lets move this problem to the next level Lets say we are writing name consisting of 3 letters, XXX and lets say we can only use Red or Blue colour, we will mainly use Blue, but sometimes red here are the chances/restrictions 25% Red, 75% Blue, If First letter (capital letter) was Red, the next 2 letters are Blue If one of the small letters is Red, the capital letter of next name is Blue So we can end up with something like RBB BBB BBR BBB BBR BRB BBB BBR BBR BRB BRB BBB BRB BBR BRB BRB BBB etc etc or something like this How would we break this down? I am having trouble because this is becoming sort of a loop where I cant end it :| Edit, actually it is starting to make sense. I have done a bit of math, I will post it later when I have time, It is generally consist of finding blocks used to construct series, and that one of the blocks is recursively defined Block 1 RBB Block 2 ... Bbb anything that ends with BBB but doesnt start with RBB it could be BRB BBB BRB BBR BBB BBR BBR BBB etc etc The easy and dirty way to generalise this would be to consider [latex]\frac{p}{p+1}[/latex], where p is the probability of getting a B. actually not exactly if the restriction is 2 W after any B, or N W after any B the general solution will be [latex]\frac{p}{N p+1}[/latex] Edited December 15, 2016 by ConvinceMePlease
Prometheus Posted December 15, 2016 Posted December 15, 2016 I just meant generalising to any p, but yeah looks like you've got the hang of it generalising to any N too.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now