I have a few probability and stats questions and was hoping if someone could help in answering those.

1). Imagine there is a square. There is an ant at one corner of the square. At each step it reaches the other corner. The rule for it move is as follows: Flip a coin. If it is heads, the ant moves clock-wise. If it is tails, the ant moves counter-clockwise. The goal of the ant is to reach the diagonally opposite corner of square. What is the average steps the ant would take to reach there?

2). There is a building with 100 floors. You are given 2 identical eggs. How do you use 2 eggs to find the threshold floor, where the egg will definitely break from any floor above floor N, including floor N itself.

3) A Russian gangster kidnaps you. He puts two bullets in consecutive order in an empty six-round revolver, spins it, points it at your head and shoots. click You're still alive. He then asks you, do you want me to spin it again and fire or pull the trigger again. For each option, what is the probability that you'll be shot?

Thanks a ton!

  • 2
    $\begingroup$ I don't think this is a place that you can post such questions. You'll need to prove what you've done. $\endgroup$
    – SmallChess
    Jun 5 '15 at 3:13
  • $\begingroup$ Well I am trying out Stats 101 knowledge on some probability questions. And no I am not in college so these are not homework questions. I came across these on a stats forum and found a bit difficult to solve. So thought this forum could help me learn how to think about these problems in general $\endgroup$
    – Baktaawar
    Jun 5 '15 at 3:15
  • $\begingroup$ First problem is expected hitting time of random walk.google that.simplest solution is by setting up recursion based on expected hitting time at position x in terms of x+1,x-1. Third 1 is well known but don't know name..look at 'Monty hall'problem in think bayes greenteapress.com/thinkbayes/html/thinkbayes002.html#toc13 $\endgroup$
    – seanv507
    Jun 5 '15 at 6:14
  • 2
    $\begingroup$ @user: It's immaterial whether the questions are for homework or for fun: sufficient justifications for our policy are first that we don't want CV to become a compendium of answers to standard textbook exercises, & second that it's of more (lasting) benefit to you to get help in solving the problems yourself rather than being told the answer (if you are kidnapped by a gangster you probably won't have internet access). So please do use CV to help you learn to think about these problems - in accordance with the self-study rules. $\endgroup$ Jun 5 '15 at 9:35
  • $\begingroup$ 2 is not a stats/data-science question. no probability involved. It's a classic brain-teaser for job interviews (albeit such teasers are apparently now frowned upon, because too many prepare for these questions and then turn out to be foul eggs when confronted with real challenges.) $\endgroup$ Jun 5 '15 at 17:01

As noted in the comments to your question, Stack Exchange frowns on answering these type of questions that lack any demonstration of work so far as they read like homework questions (or interview questions in this case) on which you've made no effort to solve. But they're fun, so typical stack exchange chiding aside here's my try at what are three interesting problems:

1) The answer is roughly 4, as estimated by simulation in Python:

import random
import pandas as pd

def ant():
    i = 1
    j = 1

    while True:
        i = max(0, i + random.sample([-1,1], 1)[0])
        j += 1
        if i == 2:

            i = 1
            j += 1

    return j

ants = []

i = 0

while i < 100000:
    i += 1

df = pd.DataFrame(ants, columns = ['turns'])
print(df.mean()) #About 4

The key here is that if the ant can walk closer (+1) or farther (-1) away, but is never gets more than 2 moves from its destination and starts 2 moves from its destination. You also need to factor in that if two moves away the ant always moves closer (because they're moving around a square rather than along a line). So the else statement adds this handicap by tacking on a move and starting them at 1 if they end up 0 (which represents their original starting point from which they can only get closer to the destination).

For 2, I believe you copied the problem incorrectly (it typically asks about the optimal strategy for the fewest number of drops). As you ask the question, you only need one egg. You just precede from 1 to 2 to 3, to 4, and when the egg breaks at n you know the threshold floor. This is assuming a perfectly deterministic rather than stochastic process, i.e. the egg either always or never breaks at a given floor, which is probably not true in the real world. If you account for randomness, then you need to consider the possibility that an egg will crack below the floor that it's guaranteed to crack at with probability 1. So I'll let someone else take a stab at how to estimate the threshold floor with two eggs and provide more practical advice: if you don't want eggs to break stop dropping them out of a window from any story.

3) If you spin you have a straightforwand 2/6 = 1/3 chance of biting a bullet. If you do not spin there are two bullets and five slots, except that you know you're not about to bite bullet 2 (in order) because you did not just bite bullet 1, so you can rule bullet 2 out and you thus have a 1/4 chance of getting shot if he does not spin. So don't spin.

  • 2
    $\begingroup$ Questions like (1) can usually be solved recursively, often in less time than it takes to write a simulation. If $e_2$ is the expected number of steps from the original point and $e_1$ is the expected number from either of its neighbors, then (a) since the first step is necessarily to a neighbor, $e_2=e_1+1$. From there, there is a $1/2$ chance of arriving at the goal or going back to the beginning, whence $e_1 = 1 + (0+e_2)/2$. This simple set of linear equations has a unique solution, easily found. $\endgroup$
    – whuber
    Jun 5 '15 at 15:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.