r/learnquant • • 14h ago

interview prep Quant Interview Question

Post image
24 Upvotes

11 comments sorted by

4

u/comoespossible 13h 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 14h ago

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

2

u/Local_Ad135 14h ago

yeah

1

u/NomaTyx 13h ago

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

1

u/comoespossible 13h ago

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

1

u/No_Place_4096 13h 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 12h 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 12h 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 12h ago

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

1

u/comoespossible 12h 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.

0

u/[deleted] 13h ago

[deleted]

1

u/No_Place_4096 13h ago

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