Hedge Funds puzzles, solved step by step
- Puzzles
- 100
- Traced to a firm
- 38
- Topics
- 14
- Hard
- 30
011An ant starts at one corner of a cube and at each step walks along an edge to a randomly chosen neighbouring corner. What is the expected number of steps until it first reaches the opposite corner?Quant and systematic fundsProp and quant trading firms
Try it first
Pick your estimate before you set anything up.
Show the worked solution
10 steps. Group the eight corners by how many edges separate them from the target: one corner at distance 3, three at 2, three at 1, and the target itself. From 3 the ant must move to 2; from 2 it slips back to 3 one time in three; from 1 it reaches the target one time in three. Solving the three equations gives 10 from the start, 9 from distance 2 and 7 from distance 1.
How do you turn eight corners into four states?
Ask a lost tourist how far they are from the station, not which street they are on. Every corner at the same distance from the target behaves the same way, so the distance is all you need to track. Collapsing the cube by distance turns eight corners into four states, 3, 2, 1 and 0, and the walk becomes a short chain. From distance 3 all three neighbours are at distance 2. From 2, one neighbour is back at 3 and two are at 1. From 1, two neighbours are at 2 and one is the target.
Grouped by distance from the target, the ant moves from 3 to 2 for certain, from 2 forward with probability two thirds, and from 1 home with probability one third, which gives expected times of 10, 9 and 7 steps from distances 3, 2 and 1. The relationshipE_k the expected steps still needed from a corner at distance k 1 the step being taken now What it says in wordsEach expected time is one step plus the average of the expected times from wherever that step lands.How do you solve the equations quickly?
Substitute from the two ends into the middle. Put E3 = 1 + E2 and E1 = 1 + 2E2/3 into the middle equation and it collapses to E2 = 2 + 7E2/9, so E2 = 9, E3 = 10 and E1 = 7. Then sanity-check the odd-looking one: from distance 1 the ant sits right next to the target yet still needs seven steps on average, because two of its three moves lead away. A number that surprises you is worth one sentence of explanation, not a recalculation.
What is the skill a fund is actually testing?
The same first-passage logic tells you how long a mean-reverting spread takes to reach a target or a stop, and how many moves a process needs to hit a barrier. Whenever many states behave alike, lump them, write one equation per lumped state, and solve: that is the skill, and the cube is only the costume. Candidates who write eight equations, one per corner, get the right answer too, but too slowly for the room.
Where candidates lose it
Answering 3, the length of the shortest path, is the fast mistake. The ant does not know where it is going, and from every corner except the start it is at least as likely to wander as to advance.
The slower mistake is writing eight equations, one per corner. It works, but it takes far longer than the interview allows. Say the symmetry out loud first: corners at the same distance are interchangeable.
What the interviewer asks next
- What is the expected number of steps for the ant to return to its starting corner?
- What if the ant stays put with probability one half at each step?
- On a square, what is the expected time to reach the opposite corner?
021A stock with 20% annual volatility and no drift starts at Rs 100. Roughly what is the chance it ends the year more than 10% higher, and what is the chance it touches Rs 110 at some point during the year?Quant and systematic fundsProp and quant trading firms
Try it first
How does the chance of touching 110 compare with the chance of finishing above it?
Show the worked solution
About 31% to finish above Rs 110, and about 62% to touch it during the year. A 10% move is half of one year's 20% standard deviation, and a normal variable ends more than half a standard deviation up 30.9% of the time. By the reflection principle, every path that touches 110 and ends below has a mirror twin that ends above, so touching is twice as likely as finishing above: 61.7%.
Why is finishing above 110 about a one in three chance?
Scale the move by the volatility. Over one year the price spreads out with a standard deviation of about Rs 20, so Rs 110 is half a standard deviation above the start, and a normal variable finishes more than half a standard deviation up 30.9% of the time. Treating the price as an arithmetic random walk is close enough for a 10% move; a lognormal model, in which prices cannot go negative, gives a slightly lower figure, about 28%. Say you are approximating, and say which way the error runs.
A path that touches 110 and ends below it has a mirror twin, reflected in the barrier after the first touch, that ends above it, so the chance of touching 110 during the year, 61.7%, is twice the chance of finishing above it, 30.9%. Why is touching twice as likely as finishing above?
Think of a walker on a foggy path who is equally likely to step forward or back. Once she reaches a marker post, her remaining steps are a fair coin again: from the post she is as likely to end past it as short of it. So for every path that touches 110 and ends below, reflecting the part after the touch gives an equally likely path that ends above; touching paths split evenly between the two. Every path that ends above must have touched on the way, so the chance of touching is twice the chance of ending above.
The relationshipb the barrier, Rs 110 S_T the price at the end of the year 0.5 the barrier's distance in standard deviations: 10 / 20 What it says in wordsFor a driftless continuous walk, the chance of ever reaching a level is double the chance of finishing beyond it.Where does the factor of two matter on a desk?
Anything that triggers on a touch rather than on the finish. A stop-loss set 10% away is hit about twice as often as the price ends beyond it, and an option that pays on a touch is worth roughly twice one that pays only if the price finishes past the same level. The limitation: the factor of two holds for a driftless, continuously watched walk. Drift, jumps and checking the price only at the daily close all move it, and a checked-daily barrier is touched a little less often than a continuous one.
Where candidates lose it
The common error is answering the touch question with the finishing probability, 31%, as though the path does not matter. A price can visit 110 in March and be back at 100 by December, and the question asked about the visit.
The second is forgetting to scale by volatility. Ten per cent sounds small, but against 20% a year it is half a standard deviation, not a rare event. Say the scaling first, then the number.
What the interviewer asks next
- What is the chance the stock touches Rs 90 during the year?
- Roughly what is the chance it touches both 110 and 90?
- How does a positive drift change the ratio between touching and finishing above?
036A regime model says a bull month is followed by another bull month 90% of the time, and a bear month by another bear month 80% of the time. In the long run, what share of months are bull months?Quant and systematic fundsProp and quant trading firms
Try it first
Long-run share of bull months:
Show the worked solution
Two thirds of months are bull months, whatever the starting state. In the long run the number of months switching from bull to bear must equal the number switching back. 10% of bull months switch out and 20% of bear months switch in, so 0.1 x bull = 0.2 x bear, which makes bull twice as common as bear: 2/3 against 1/3. A second route: bull spells last 10 months on average and bear spells 5.
What has to balance in the long run?
Think of a shop with people walking in and out all day. Once the crowd inside stops growing or shrinking, the number walking in each minute must equal the number walking out. In the long run, the flow from bull to bear must equal the flow from bear to bull, because otherwise one state would keep filling up. The flow out of bull is 10% of bull months; the flow out of bear is 20% of bear months. Setting 0.1 x bull equal to 0.2 x bear, with bull plus bear equal to 1, gives bull = 2/3.
Bull months turn bear 10% of the time and bear months turn bull 20% of the time, so the long-run share of bull months is two thirds, and a chain started in either state is within a few points of two thirds after about a year. How do you check two thirds another way?
Use the length of each spell. A state you leave with probability p each month lasts 1/p months on average, so bull spells last 10 months and bear spells 5. Spells alternate, so over a long stretch the market spends 10 months bull for every 5 bear: 10 out of 15 is two thirds. Two methods that agree is what the interviewer is listening for.
The relationshippi_bull the long-run share of bull months 0.1, 0.2 the chances of leaving bull and leaving bear each month 0.7 how much of any starting gap survives each month What it says in wordsThe long-run share of a state is the chance of entering it divided by the total chance of switching, and the start is forgotten at a rate of 0.7 a month.Answer the part of the question people skip: why the starting state does not matter. The gap between today's odds and two thirds shrinks by a factor of 0.7 every month, so after 12 months only 1.4% of it is left. A model this sticky still forgets its starting point within about a year, which is why regime forecasts beyond a few months mostly return the long-run average.
Where candidates lose it
The first loss is answering 90%, the one-step persistence, as if it were the long-run share. The second is saying it depends on today's state, which is true for next month and false for the long run.
Set up the flow balance in one line, give two thirds, then check it with spell lengths of 10 and 5 months. If you have time, say how fast the start is forgotten: 0.7 a month.
What the interviewer asks next
- Today is a bear month. What is the chance that the month after next is a bull month?
- How long does the average bear spell last, and what is the chance one lasts more than a year?
- How would you estimate the two transition probabilities from 20 years of monthly data, and how wide would the error be?
086A stock ticks up or down by Rs 1 each minute with equal probability, starting at Rs 50. On average, how many minutes pass before it first touches Rs 45 or Rs 55?Quant and systematic fundsProp and quant trading firms
Try it first
Pick your answer before setting up any equation.
Show the worked solution
25 minutes. Let E(k) be the expected minutes to exit from price k. Each minute costs one and moves the price up or down with equal chance, so E(k) = 1 + half E(k + 1) + half E(k - 1), with E(45) = E(55) = 0. The solution is E(k) = (k - 45)(55 - k), the product of the distances to the two barriers. From Rs 50 that is 5 x 5 = 25.
Why is the answer not 5 minutes?
Think of someone pacing a corridor, taking one step forward or back on each coin toss. After 25 steps they are not 25 steps away; typically they are about 5 away, because the steps keep undoing each other. A fair random walk covers distance like the square root of time, so reaching a barrier 5 away takes on the order of 5 squared, 25 steps, not 5.
Three sample paths from Rs 50 leave the Rs 45 to Rs 55 channel after 11, 23 and 45 minutes; averaged over all paths the exit takes (50 - 45) x (55 - 50) = 25 minutes, and from Rs 48 or Rs 46 it takes 21 or 9. How do you get exactly 25?
Set up the one-step equation. From any price k strictly between the barriers, you spend one minute and then stand at k + 1 or k - 1 with equal chance. E(k) = 1 + half E(k + 1) + half E(k - 1) says the second difference of E is always minus 2, so E is a downward parabola that is zero at both barriers. The only such parabola is (k - 45)(55 - k). Check a point: from Rs 46 it gives 1 x 9 = 9 minutes, and it passes the one-step test, since 1 plus half of E(47), which is 16, plus half of E(45), which is 0, is 9.
The relationshipa, b the lower and upper barriers, Rs 45 and Rs 55 k the starting price E(k) the expected number of one-minute steps before either barrier is touched What it says in wordsFor a fair walk, the expected time to leave a channel is the distance to the floor times the distance to the ceiling.What does the shape tell a trader?
Starting in the middle is the slowest place to be, and an off-centre start is much faster: from Rs 48 the answer is 3 x 7 = 21 minutes, and from Rs 46 only 9. Doubling both distances quadruples the expected time: barriers at Rs 40 and Rs 60 give 100 minutes. That is the arithmetic behind why widening a stop and a profit target together makes a trade live much longer. It holds only for a fair walk: if the stock ticks up 60% of the time, the exit comes sooner, about 19.2 minutes, and mostly at the top.
Where candidates lose it
The quick wrong answer is 5 minutes, which treats the walk as if it moved steadily towards one barrier. A fair walk wanders, and the interviewer is checking whether you know that distance grows with the square root of time.
The second loss is reaching 25 from the square-root intuition without being able to show it. Write the one-step equation and the parabola; that is what turns a good guess into an answer.
What the interviewer asks next
- What is the probability the stock touches Rs 55 before Rs 45?
- From Rs 50, the barriers move to Rs 40 and Rs 55. What is the expected time now?
- The stock ticks up with probability 0.6. Why does the expected time fall?
096You roll a fair die repeatedly and keep a running total. What is the probability that the total is ever exactly 10? What does the answer approach for large targets?Quant and systematic fundsProp and quant trading firms
Try it first
Roughly what is the chance the running total ever hits exactly 10?
Show the worked solution
About 0.289, and it settles at 2/7, about 0.286, for large targets. Let p(n) be the chance the total ever equals n. To hit n, the total must first land on one of n - 1 to n - 6 and then roll exactly the gap, each with chance 1/6, so p(n) is the average of the six values before it, with p(0) = 1. Working up gives p(10) = 0.2893. Totals advance 3.5 a roll on average, so they land on 1 number in 3.5.
How do you set up the recursion?
Think about the last roll before the total reaches n. The total can land exactly on n only by first landing on one of n - 1 down to n - 6 and then rolling exactly the gap, each with chance 1/6, so p(n) = (1/6)[p(n - 1) + ... + p(n - 6)]. Start with p(0) = 1, because you begin at zero, and p of any negative number = 0. Then p(1) = 1/6, p(2) = 7/36, p(3) = 0.227, and so on up to p(10) = 0.2893.
The chance of ever landing on a total climbs from 1/6 at 1 to a peak of 0.360 at 6, then wobbles and settles onto 2/7, about 0.286; the target of 10 is hit with probability 0.289. Why does the answer settle at 2/7?
Picture stepping stones across a river, where each stride covers 1 to 6 stones with equal chance. Over a long walk you touch about one stone in every 3.5, because that is your average stride. The running total advances 3.5 per roll on average, so in the long run it lands on a fraction 1/3.5 = 2/7 of all numbers, and each far-off target is hit with probability close to 2/7. The early values wobble: p(6) is the highest, 0.360, because 6 is the last total a single roll from zero can reach directly, and the wobbles die out by about 20.
The relationshipp(n) the chance the running total ever equals n p(n - k) the chance of standing k below the target, one roll away E[roll] the average roll of a fair die, 3.5 What it says in wordsEach total's chance is the average of the six before it, and in the long run the totals land on one number in every 3.5.Why would a quant interviewer ask for a table or code here?
Because the recursion is dynamic programmingSolving a problem by building up answers to smaller versions of it and reusing them, instead of recomputing from scratch.: each value reuses the six before it, so a table of ten numbers is faster and safer than listing every sequence of rolls that sums to 10. Say the recursion, compute a few terms out loud, and give the limit with its reason; that is the complete answer. Do not try to enumerate paths: there are 492 ordered ways to reach 10 with rolls of 1 to 6, each with its own probability.
Where candidates lose it
The quick answers are 1/6, reasoning that some roll must land on 10 with one chance in six, and 2/7 stated as exact. The first ignores that most runs skip straight over 10; the second is close but is the long-run limit, and 10 is not yet far enough out for it to be exact.
The second loss is trying to count paths. Set up the recursion in one line instead and let it do the counting.
What the interviewer asks next
- What is the probability that the running total ever equals exactly 6?
- With a coin that adds 1 or 2 instead of a die, what does the hit probability approach?
- How would you write this as a dynamic programme in a few lines of code?
