[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 381 KB, 1600x900, wallpaper-2320393.jpg [View same] [iqdb] [saucenao] [google]
5236103 No.5236103 [Reply] [Original]

Let's say I've got a coin.

I start at zero, then flip the coin. If it's heads, I add one; tails, I subtract one. What's the average number of coin flips it takes to get back to zero? I'm completely lost here.

>> No.5236112
File: 70 KB, 618x564, 618px-Trollface_HD.png [View same] [iqdb] [saucenao] [google]
5236112

none.

>> No.5236164

bumping once.

>> No.5236167

>>5236164
pick an even number

>> No.5236171

>>5236169
decreases*

>> No.5236169

There is no "average" number of coin flips that it takes to get back to zero. As your sample size increases, the chances of your total being zero increases.

>> No.5236181

>>5236171

No.

>> No.5236185

It's a binomial distribution...

This isn't that bad.

It's symmetric around total flips / 2.

Weird question.

>> No.5236204

>>5236169
That doesn't sound right to me.
The probability of having an equal number of heads and tails should get increase towards 1 as I continually flip the coin.

>> No.5236206

>>5236204
Actually, I see my mistake; my bad.

>> No.5236224

>>5236103
The chances of the amount of total heads and total tails being equivalent is sqrt(x), where x is the number of total flips.

>> No.5236227

I cannot into probability, so I've been running coin flip simulations in java to get an empirical answer. I simulate flipping a coin intill the total goes back to zero. I repeat this n times and take the average.

The average number is huge. You get a lot of small values (<20) but you'll occasionally see series of flips that take thousands of flips to reach 0. For instance, one of my coins in my last simulation took two million flips to return to zero. In fact, as I increase n, the average only grows rapidly. Due to this data, I conjecture that the average is infinite.

>> No.5236228

>>5236185
two is the minimum.

<span class="math">\sum \frac{2n!}{2^n}[/spoiler]

>> No.5236231

>>5236224
Er.. I misworded this. *The chances of the amount of total heads and total tails being equivalent at any one flip is sqrt(x), where x is the number of total flips. The chances of your number being 0 will tend towards 50% as the amount of flips increases.

>> No.5236247

>>5236231
Where are you getting that from? Your formula predicts probabilities >1.

>> No.5236275

>>5236103
The average number of coin flips get back to zero is infinite.
However, the probability of eventually getting back to zero is 1.

>> No.5236306
File: 96 KB, 774x633, data.jpg [View same] [iqdb] [saucenao] [google]
5236306

>>5236227
Data from said simulation. X axis is the total number of coins flipped (ie, untill the coin reaches a total of 0). y axis is the total number of flips. I ran 10,000 coins. Note the large discontinuity. This happened when one coin took over one billion flips to reach a total of 0.

>> No.5236314

>>5236306
Your labelling seems to suck then.

>> No.5236319
File: 35 KB, 594x371, Dices.png [View same] [iqdb] [saucenao] [google]
5236319

I don't want to start a ne thread so I will post here since it's related.

If I roll a dice 10 times, what is the chance I will get exactly 4 times the number 2?

I know the awnser but I don't know how to get there.

>> No.5236321

>>5236169
Average means expectation value, dipshit.


It might well be that the expectaiton value is infinite because the sum that would be necessary to evaluate it doesn't converge.

>> No.5236320

>>5236275
if there's a 50% chance you're back at 0 after two flips, how can the average be infinite?

>> No.5236323

>>5236320
The series not converging.

>> No.5236333

>>5236275
I remember that the probability of hitting any number is one, I can't remember anything about the expected time though, but infinity is the obvious answer.

>> No.5236329

>>5236319

(1/6)*(1/6)*(1/6)*(1/6)*(5/6)*(5/6)*(5/6)*(5/6)*(5/6)*(5/6) = 0.025840893 %

>> No.5236343

>>5236319
one of hte sample spaces we can choose has 6^10 possibilities.

from the 10 rolls, there are 10C4 ways of choosing rolls to get twos (e.g. the first, second, third and fourth rolls could all be twos, or the first ,second third, and fifth rolls could all be twos) and all the other rolls can get any number they want apart form 2. so multiply by 5^6.
e.g.

( 10C4 * 5^6 ) / 6*10

>> No.5236356

>>5236329
Why just p^r * q^(n-r)? Don't you need to multiply by 10C4 also?

>> No.5236354

>>5236319
Pretty simple, do nCr (10C4) times probability of getting 2 raised to the r ((1/6)^4) times probability of not getting 2 raised to the n-r ((5/6)^6).

>> No.5236365 [DELETED] 

>>5236356

My bad

[ (1/6)*(1/6)*(1/6)*(1/6)*(5/6)*(5/6)*(5/6)*(5/6)*(5/6)*(5/6) ] * 6 * 4

>> No.5236361

>>5236329
I thought like this too, it's wrong.

>>5236343
( 10C4 * 5^6 ) / 6*10
Is wrong, you mistyped.
( 10C4 * 5^6 ) / 6^10 is right though, thanks.

I will now try and understand why.

>> No.5236388

>>5236361
Okay, I get it.
10C4 is the 4 places where the 2 can go.
5^6 is the 6 places where each other 5 possible results can go.

6^10 is the total possible options.

>> No.5236393

http://en.wikipedia.org/wiki/Grandi's_series

>> No.5236406

>>5236388
yes. But really, thiking about it as a binomial distribution problem is better than thinking about it as combinatorics problem, even though they're equivalent, because the binomial distribution is used a lot more and its better to become familiar with it.

>> No.5236414

>>5236361
It's because of the formula used that I posted earlier here but you changed the order.>>5236354

<span class="math"> {n! \over (n-r)!r!} * p^(n) * q^(n-r) [/spoiler]

>> No.5236445
File: 1.21 MB, 1500x1875, 1350715747091.jpg [View same] [iqdb] [saucenao] [google]
5236445

>>5236227
>Java

>> No.5236454

>>5236227
This is an awesome example of how averages fuck up everything by including extreme values...

>> No.5236452

>>5236406
I haven't yet learned it, I am oblivious as to what you said.

Another question
Every shot John makes is a 25% chance of scoring.
He makes 12 shots in one game.
What are the chances that he scores exactly 4?

I know it starts like this:
[(1/4)*(1/4)*(1/4)*(1/4)*(3/4)*(3/4)*(3/4)*(3/4)*(3/4)*(3/4)*(3/4)*(3/4)]

But now what do I multiply it by now?

>> No.5236461

>>5236452
Multiply by 12C4.

>> No.5236462

>>5236445
So you'd recommend lisp instead, yes?

>> No.5236472

>>5236461
This works. I don't get why, but it does.

>> No.5236482

>>5236472
Basically, you calculated the chances of getting the first 4 in. When you multiply by 12C4 you are accounting for any reorderings.

>> No.5236495

>>5236482
Oh, I see. thanks for helping me out.

>> No.5236517

>>5236103
I am interested by your problem, and I made a simple program. The output is the average number of total flips over 10000 trials:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int flipcoin()
{
int a = rand() % 2;
return rand() % 2;
}

int trial()
{
int total = 0;
int num = 0;
do
{
total = total + (2*flipcoin()-1);
num++;
}
while(total != 0);
return num;
}
int main()
{
srand(time(NULL));
int num = 0;
int x;
for(x = 0; x < 10000; x++)
{
num = num + trial();
}
printf("%f", num/10000.0);
return 0;
}

I get a LOT of variation from every run: anywhere from about 150 to about 3000. Not sure if there are issues in my program, though.
Any thoughts?

>> No.5236541

>>5236517
bumping for me

>> No.5236544

>>5236517
Can't see anything wrong, but it should deviate a lot... Sometimes you're going to have really really long flips.

>> No.5236548

>>5236544
Yeah, I saw that. Some of the flips lasted over 20000 coin tosses, it's crazy.

>> No.5236597

pick a even number under fifty and try it out IRL. should be near to zero, at least single digits if not

>> No.5236644

>>5236517
The likelihood is that there is no expectation value because teh sum required to calculate the expectation value diverges.

in other words, if there were a game where you were payed the number of dollars equal to the number of flips the coin would require to get back to zero, you should in theory be prepared to pay ANY amount of money to play this game.

I haven't analysed the form of the expectation value sum yet though so I can't prove this exactly.

>> No.5236784
File: 44 KB, 878x657, Screen Shot 2012-11-09 at 00.27.11.png [View same] [iqdb] [saucenao] [google]
5236784

So one way we could prove that there the expectation value is infinite is to find the number paths through structures like these (n = the number of flips).

>> No.5236788
File: 105 KB, 705x631, data.jpg [View same] [iqdb] [saucenao] [google]
5236788

>>5236517
I have a similar program. Results posted
>>5236306
>>5236227

Here is a new addition - I plot the change in the average over time over 10,000 trials. Note how the average increases over trials.

>> No.5236807
File: 58 KB, 921x892, Screen Shot 2012-11-09 at 00.34.07.png [View same] [iqdb] [saucenao] [google]
5236807

>> No.5236869

<div class="math">E[X]=\sum_{n=1}^{\infty} {2n \over 2^{2n}} \left( \frac{4n}{2n-1} {2 n -1\choose n} - {2n \choose n} \right) = \infty</div>

>> No.5236883
File: 5 KB, 171x60, Screen Shot 2012-11-09 at 00.58.30.png [View same] [iqdb] [saucenao] [google]
5236883

>>5236869
Yeah this is the part I couldn't get to. Please could you explain your wizardry.

>> No.5236900

>>5236869
Tell me how you did this you fucking nigger.

>> No.5236979

>>5236883
>>5236900
<div class="math">E[X]=2 E[X/2]=2 \sum_{n=1}^\infty n \; \mathrm{P}([X/2 = n]) = \sum_{n=1}^\infty 2n \; \mathrm{P}([X = 2n]) = \sum_{n=1}^{\infty} {2n \over 2^{2n}} \left( \frac{4n}{2n-1} {2 n -1\choose n} - {2n \choose n} \right) = \sum_{n=1}^{\infty} {1 \over 4^n} \frac{2n}{2n-1} {2 n \choose n}</div>
This is infinity because
<div class="math">{2 n \choose n} = \frac{(2n)!}{(n!)^2} \sim \frac{4^n}{\sqrt{\pi n}}</div>
by Stirling's formula.