Skip to main content

Posts

The Four Numbers Puzzle

Q: There are four integer numbers chosen purely randomly and added up. You are told that the resulting number is even. What is the probability that all the original numbers were even? An Introduction to Probability Theory and Its Applications, Vol. 1, 3rd Edition A: If we did not know any information about the resulting number, then the probability of all numbers being even is simply \(\frac{1}{16}\) as there are \(2^{4} = 16\) ways for choosing 4 numbers as either odd or even. However we do know that their sum is even. In addition to the above the following also holds. The sum of two even numbers is always even If \(x_1 = 2n + 2\) is an even number and \(x_2 = 2m + 2\) is another even number, their sum is \(2(n+m) + 4\) which is even. The sum of two odd numbers is also always even  If \(x_1 = 2n + 1\) is an odd number and \(x_2 = 2m + 1\) is another odd number, their sum is \(2(n+m) + 2\) which is even. The sum of an odd and an even number is always odd If \(x_1...

Getting Heads in a Row

Q: You have a fair unbiased coin. How many times on average do you need to toss it to get \(n\) heads in a row. Introduction to Probability Theory A: This is another of those problems that can be best solved in a recursive manner. Assume that the expected number of throws to get \(n\) heads is \(x_{n}\). To get to \(x_{n+1}\) we would need to toss it one more time. But there is no guarantee that the next toss would result in a head. It would result in a head with probability \(\frac{1}{2}\) or a tail with the same probability.  If it falls a tail, all our effort so far goes to naught and we have to start over with the added cost of having tossed once. So, with probability \(\frac{1}{2}\) we toss it \(x_{n} + 1\) times and with probability \(\frac{1}{2}\) we toss it \(x_{n+1} + 1\). Phrasing this recursively gives us $$x_{n+1} = x_{n} + \frac{1}{2}\times 1 + \frac{1}{2}(x_{n+1} + 1) $$ further simplifying to give $$\fbox{ \(x_{n} = 2^{n+1} - 2\)}$$ If you are l...

The Random-Picker Algorithm

Q: You have a queue of people outside your office door and you want to pick exactly one person at random. However you do not know the length of the queue. You are allowed to accept a person and then reject that person when you see another should you so choose. How do you do it? Fifty Challenging Problems in Probability with Solutions (Dover Books on Mathematics) A: At first look, this seems impossible to solve. How do you randomly pick when you don't know what the denominator is? It could be 5, 10 or 100s. Surprisingly, the following strategy works beautifully. Keep a counter on the number of persons who come in, call this counter \(i\). For every person coming in, pick that user with probability \(\frac{1}{i}\) When the \(\{i + 1\}^{th}\) person comes in, with probability \(\frac{1}{i+1}\) replace the existing person. The above algorithm works by ensuring that the selected person is indeed picked up with probability \(\frac{1}{n}\) where \(n\) is the number of persons in th...

Lions Tigers and Bears

Q: You are told that a certain area in a forest has lions, tigers and bears. You tour that area and observe 5 tigers, 2 lions and 1 bear. What is your estimate on the distribution of these animals? Fifty Challenging Problems in Probability with Solutions (Dover Books on Mathematics) A: This is a good example to demonstrate the multinomial distributions, it's application and also introduce the concept of "conjugate priors". Lets deal with them one at a time and then revisit the problem. The Conjugate Prior: This concept is part of Bayesian analysis. Lets assume you have a prior which belongs to a "family" of functions say \( y = f(\theta,x) \). You get some additional information and you update your estimate such that the posterior belongs to the same family of functions. So the prior and posterior differ only in the parameters that go into the function and not in its form and structure. An example of conjugate priors is the Gaussian distribution. ...