View Full Version : Resolved odd math question
james438
05-24-2012, 06:40 PM
Let's say I flip a coin twice. What are the odds that it will land on heads at least once?
depends. did it land on heads at least once?
:p
as far as prediction goes, depends on a lot, such as whether or not the coin spins, whether one side is heavier, and so forth.
djr33
05-24-2012, 09:32 PM
Assuming it's just 50-50 for the first flip, or 1/2:
It's easier to calculate the odds of it never landing on heads. I believe that's just 1/2*1/2 = 1/4. So for 3 tries, it should be 1/2*1/2*1/2, or just (1/2)^3 = 1/8. Then subtract that value from one, so you get 3/4 and 7/8, etc.
I forget the details of this math, but it's easy enough to work out at least this simple problem by hand, with 0=tails, 1=heads.
11
00
10
01
So 3/4.
You can also think of it like this: if you flip it one time, it's 1/2. If you flip it again, it's another half of those times after the first half, so it's 1/2 + (1/2)/(1/2) = 3/4. And so on, each time adding half of the remaining amount. This is very similar to the famous "walk halfway to the wall then repeat and keep repeating that" example.
james438
05-24-2012, 09:45 PM
Hah! thanks :) I thought it would be something simple like that, but it just wasn't coming to me.
ApacheTech
05-25-2012, 03:44 AM
Assuming a fair coin you have a 1/2 probability of getting a head or a tail on any one flip of the coin. If you are flipping the coin twice then the probability of getting at least one head equals 1 - P(no heads) = 1 - P(two tails) = 1 - 1/2 * 1/2 = 3/4.
Let X be the number of heads. X has the binomial distribution with n = 2 trials and success probability p = 0.5
In general, if X has the binomial distribution with n trials and a success probability of p then
P[X = x] = n!/(x!(n-x)!) * p^x * (1-p)^(n-x)
for values of x = 0, 1, 2, ..., n
P[X = x] = 0 for any other value of x.
The probability mass function is derived by looking at the number of combination of x objects chosen from n objects and then a total of x success and n - x failures.
Or, in other words, the binomial is the sum of n independent and identically distributed Bernoulli trials.
X ~ Binomial( n , p )
the mean of the binomial distribution is n * p = 1
the variance of the binomial distribution is n * p * (1 - p) = 0.5
the standard deviation is the square root of the variance = √ ( n * p * (1 - p)) = 0.7071068
The Probability Mass Function, PMF,
f(X) = P(X = x) is:
P( X = 0 ) = 0.25
P( X = 1 ) = 0.5
P( X = 2 ) = 0.25
The Cumulative Distribution Function, CDF,
F(X) = P(X ≤ x) is:
x
∑ P(X = t) =
t = 0
P( X ≤ 0 ) = 0.25
P( X ≤ 1 ) = 0.75
P( X ≤ 2 ) = 1
1 - F(X) is:
n
∑ P(X = t) =
t = x
P( X ≥ 0 ) = 1
P( X ≥ 1 ) = 0.75
P( X ≥ 2 ) = 0.25
james438
05-25-2012, 04:22 AM
Math is a huge field and your answer certainly goes into the finer details of the math behind my question. Sadly, it has been nearly 20 years since I have looked at those equations, so it is mostly new to me again. Do you have a link that would help to explain the math behind this problem so that others (myself included) can read up more on this?
djr33
05-25-2012, 04:30 AM
James, what are you trying to do? I think ApacheTech's answer is significantly beyond what you need to do for anything in the domain of your original question, but certainly probability theory can get that complicated if you want to do it more in depth. The question is whether you need to get into the details of it or just use the more basic cases for your current project.
james438
05-25-2012, 07:10 AM
His answer does go way beyond what I need, but I felt I should respond at least in respect to all of the work that went into his answer. A lot of it is certainly past my understanding of the subject though.
My question was really just part of some ponderings I have recently had on basic probability. It is not part of any larger web design project.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.