r/learnquant • • 2d ago

interview prep Quant Interview Question

Post image
29 Upvotes

12 comments sorted by

6

u/comoespossible 2d ago

Consider this thing as a Markov chain with states 0, H, HT, and HTH. Let p be the probability that it takes an odd number of steps to get to HTH if you start from 0, let q be the probability it takes an even number if you start from H, and let r be the probability it takes an odd number if you start from HT.

First step analysis gives us p=q/2+(1-p)/2, q=r/2+(1-q)/2, and r=1/2+(1-p)/2. Re-arranging these gives us a way to write q in terms of p, r in terms of q, and p in terms of r, so we can easily solve for each of them. We get p=10/19, q=11/19, and r=14/19.

The conditional probability we're looking for is P(1st is H and X is odd)/P(X is odd) = (1/2 * q)/p = 11/20.

1

u/NomaTyx 2d ago

...the first toss? like the first toss out of all tosses?

3

u/Local_Ad135 2d ago

yeah

1

u/NomaTyx 2d ago

...so like just 0.5? is this a real interview question?

1

u/comoespossible 2d ago

Conditioning on X being odd gives you more information that changes the distribution of the first toss.

1

u/No_Place_4096 2d ago

Nah, you can't condition something happening first on something happening later. Try the experiment and see. There is no retro causality.

1

u/NomaTyx 2d ago

there actually is. think about it this way: if the first throw is heads, I can hit HTH immediately, which is odd. if the first throw is tails, THTH is even. There is actually a difference.

2

u/No_Place_4096 2d ago

I agree. I miss read the question. The condition picks out a subset of the sequences. This subset is not balanced.

1

u/NomaTyx 2d ago

yeah it's actually tricky, i didn't even consider it

1

u/comoespossible 2d ago

The problem is asking about a conditional probability ("given that X is odd"). If you run the experiment a large number of times and throw out all the runs in which X is even, the first toss will be H in more than half of the remaining ones.

1

u/justhereforfighting 1d ago

Of course you can. If I roll a die 5 times and get three 6s, what is the probability that the first roll was a 6? It isn’t just 1/6 because you know that 3 of the 5 rolls came up 6. There are only 5 possible positions for those 6s to go which means the first position is more likely to be a 6 than simply the odds of rolling a 6 in a single roll. That is a simpler example but it shows that you can absolutely condition something happening first given a later result. 

0

u/[deleted] 2d ago

[deleted] — view deleted comment

1

u/No_Place_4096 2d ago

I agree, it's correct. I missread the question.