Skip to content

Random Ant

Get access to track progress Get access to bookmark
Asset Pricingx / 34
Behavioral Questionsx / 7
Brain Teasersx / 79
Derivatives Theoryx / 107
Digital Assets - Cryptox / 82
Energy Tradingx / 55
Linear Algebrax / 24
Machine Learningx / 62
Math Questionsx / 50
Probability and Statisticsx / 369
Programmingx / 54
Totalx / 923
An ant starts at a specific corner of a cube and tries to reach the exact opposite corner of the cube. It walks randomly to neighboring corners with an equal probability of 1/3. Every time the ant travels to the next corner, a second passes. What is the expected number of seconds that it takes the ant to reach the exact opposite corner?

Figure 1 - Imagination of the cube.
First, start with numbering all corners to get a clear overview of all states. The ant starts at $s_1$ and wants to reach $s_a$. This problem can be approached as a Markov chain problem. We can start writing out all state equations:
\begin{equation}
s_1=1+s_2
\end{equation} \begin{equation}
s_2 = 1 + \frac{2}{3}s_3 + \frac{1}{3}s_1
\end{equation} \begin{equation}
s_3 = 1 + \frac{2}{3}s_2 + \frac{1}{3}s_a
\end{equation} $s_a$ is equal to zero, because it is the absorption state. We can now substitute $s_3=1+\frac{2}{3}s_2$ in Equation 2. This gives us: \begin{equation}
s_2=1+\frac{2}{3}(1+\frac{2}{3}s_2)+\frac{1}{3}s_1=\frac{5}{3}+\frac{4}{9}s_2 + \frac{1}{3}s_1
\end{equation} \begin{equation}
\frac{5}{9}s_2 = \frac{5}{3} + \frac{1}{3}s_1
\end{equation} \begin{equation}
s_2 = 3 + \frac{3}{5}s_1
\end{equation} Now we can substitute $s_2$ in Equation 1: \begin{equation}
s_1=1+(3+\frac{3}{5}s_1)=4+\frac{3}{5}s_1
\end{equation} \begin{equation}
\frac{2}{5}s_1 = 4
\end{equation} \begin{equation}
s_1 = 10
\end{equation} In other words, the expected time it takes the ant to reach the exact opposite corner is ten seconds.
Correct Answer: 10
Python scratchpad
# Run Python right here in your browser
def two_sum(nums, target):
    seen = {}
    for i, n in enumerate(nums):
        if target - n in seen:
            return [seen[target - n], i]
        seen[n] = i
    return []

print(two_sum([2, 7, 11, 15], 9))  # [0, 1]
Run Python in your browser

Write and execute code — numpy, pandas & scikit-learn included — right on the question page.

Log in to start coding
Title Category Subcategory Difficulty Status
Animal Migrations Probability and StatisticsMarkov Chain ProbabilityEasy
Unlock with a membership
Bankrupt Probability and StatisticsMarkov Chain ProbabilityEasy
Example
Bold Betting Strategy Probability and StatisticsMarkov Chain ProbabilityMedium
Unlock with a membership
Coin Series #1 Probability and StatisticsMarkov Chain ProbabilityEasy
Unlock with a membership
Coin Series #2 Probability and StatisticsMarkov Chain ProbabilityMedium
Unlock with a membership
Coin Series #3 Probability and StatisticsMarkov Chain ProbabilityMedium
Unlock with a membership
Dominant Game Probability and StatisticsMarkov Chain ProbabilityHard
Unlock with a membership
Escape the Square Probability and StatisticsMarkov Chain ProbabilityHard
Unlock with a membership
Jumping Toad Probability and StatisticsMarkov Chain ProbabilityMedium
Unlock with a membership
Parking Meter Probability and StatisticsMarkov Chain ProbabilityEasy
Unlock with a membership
Picking Tiles Probability and StatisticsMarkov Chain ProbabilityEasy
Unlock with a membership
Region Spinner Probability and StatisticsMarkov Chain ProbabilityEasy
Unlock with a membership
Stop Sign Stroll Probability and StatisticsMarkov Chain ProbabilityMedium
Unlock with a membership
The Drunkard's Walk Probability and StatisticsMarkov Chain ProbabilityHard
Unlock with a membership
Top 2000 Songs Probability and StatisticsMarkov Chain ProbabilityMedium
Unlock with a membership

Please log in to see the discussion.