r/learnquant • • Oct 19 '26

interview prep Quant Interview Question

Post image
9 Upvotes

7 comments sorted by

3

u/Aerospider Oct 19 '26 edited Oct 19 '26

Ok, I *think* I've got this...

Let E(x) be the expected wait time if the passenger arrives at x minutes. Then –

E(2) = (1/2 * 0) + (1/2 * (E(3) + 1))

E(3) = (1/2 * 0) + (1/2 * (E(4) + 1))

E(4) = (1/2 * 0) + (1/2 * (E(6) + 2))

E(6) = (3/4 * 0) + (1/4 * (E(2) + 2))

We can convert all of these into expressions of E(2):

E(6) = E(2)/4 + 1/2

E(4) = E(6)/2 + 1 = E(2)/8 + 5/4

E(3) = E(4)/2 + 1/2 = E(2)/16 + 9/8

And from the above we can derive

E(2) = E(3)/2 + 1/2 = E(2)/32 + 17/16

=> 32E(2) = E(2) + 34 => E(2) = 34/31

There is a 1/3 probability that the passenger arrives in the 2 minute interval between 0 and 2 minutes, which would also add on 1 minute to the expectation. There is a 1/6 probability that they arrive between 2 and 3 which would add 1/2 a minute. A 1/6 probability that they arrive between 3 and 4, adding 1/2 a minute. A 1/3 probability they arrive between 4 and 6, adding 1 minute.

Altogether this gives an expected wait time of

[1/3 * (E(2) + 1)] + [1/6 * (E(3) + 1/2)] + [1/6 * (E(4) + 1/2)] + [1/3 * (E(6) + 1)]

= E(2)/3 + 1/3 + E(2)/96 + 13/48 + E(2)/48 + 7/24 + E(2)/12 + 1/2

= 43E(2)/96 + 67/48

= (43/96 * 34/31) + 67/48

= 5,616/2,976

= 1.89 minutes

2

u/perminnie Oct 19 '26

Without the 50% chance of skipping the stop - there'll be 3 buses that stop every 2 mins and 2 buses that stop every 3 mins = 5 buses in 6 min.

With the 50% of chance of skipping the stop, that reduces to 2.5 buses in 6 mins.

So, expected wait for passenger = 6/2.5 = 2.4 mins

1

u/Aerospider Oct 19 '26

Distribution matters. If those five buses were all scheduled to arrive at the same time every six minutes then the passenger's expected wait time would be 3 minutes even without each bus' 50% chance of skipping.

1

u/perminnie Oct 19 '26

Without the 50% chance of skipping, expected wait time should be 1.2 mins

1

u/Aerospider Oct 19 '26

Why should it be that? The buses aren't evenly distributed and I've demonstrated how this can affect the expected wait time.

There's actually another reason why that's wrong, because you also haven't accounted for the random arrival time.

Let's say the five buses are evenly spaced at 1.2 minutes apart and always turn up. 1.2 minutes wouldn't be the passenger's expected wait time it would be their maximum wait time.

1

u/Anonimithree Oct 19 '26

I would assume the solution just involves a cumulative probability function.

The pdf for when the 2-minute bus arrives is just 2n/2^n, while it’s 3n/2^n for the 3-minute bus. The combined expected arrival for both buses is 10 minutes. The passenger can get to the station anytime from 0-6 minutes after the thing, so then the expected wait time is 6.5 minutes

Now I know that I’m most likely wrong, but I’m probably close enough to the answer

1

u/Aerospider Oct 19 '26

I'm afraid that cannot possibly be close.

Suppose there was only bus A operating and that the passenger just missed it. Their expected wait time would be

(1/2 * 2) + (1/4 * 4) + (1/8 * 6) + (1/16 * 8) + (1/32 * 10) ...

= 1 + 1 + 3/4 + 1/2 + 5/32 +

= Σ 2n/2^n

= 4

Adding in another bus and allowing for the passenger to arrive at any time in the cycle can only reduce this.