I thought it would be fun to have a section looking at some of the interview questions that I’ve faced, or heard of, during my time as a quant, and to discuss some ways of approaching them. I’ll start with a fairly simple one that I got some time ago.

One of the traders at your bank has agreed to sell a product to a client, where a coin is tossed. If it’s a tails, the client is paid $1, if it’s a head the coin is tossed again. If the second flip is a tails, the payoff is $2. Otherwise, we continue. On the third flip, if it’s a tails the payoff is $4, or $8 on the fourth flip and so on, with the pot doubling each time. The trader asks you what the price he should charge his client to play the game.

The first part of this problem is to calculate the expected payout of the game. Let’s say X is the number of heads flipped before the first tails comes up. It’s a discrete game, so we calculate the expectation by summing the payout, C(X), over the probability distribution p(X).

If the first flip is a tails, X=0 and C(X)=$1. If there’s one head then one tails, X=1 and C(X)=$2, and so on, so that

The probability of getting tails on the first flip is 0.5, so p(X=0)=0.5. The probability of getting exactly one head and then one tails is 0.25, so p(X=1)=0.25, and so on, so p(X) is given by

To calculate the expectation of the payoff, we need to sum over all possible values of X. There are an infinite number of possibilities, as we could have any number of heads before the first tails, although of course the probability gets very small so the higher X values shouldn’t contribute too much. Let’s have a look:

What is this sum? It’s the value 1 summed over all possible states of X – so each state adds the same amount to the expectation… but as we’ve already said, there are an infinite number of possible states of X, so the sum must be

Oh dear – what does this mean?! Although the probability of getting a very large number of heads is very small, the payoff in these cases is correspondingly large, so although unlikely they still add a constant amount to the expectation. This is difficult – our expected loss from this game is infinite! How can we find a reasonable price to charge the client?

Probably the best way to deal with this is to notice that most of the weight of the expectation is coming from rather unlikely payoffs involving huge sums of money and very tiny possibilities. We could artificially cut these off beyond a certain point, but in fact there’s a very natural cutoff – the bank’s solvency. Beyond a certain point, we simply can’t pay any more because we don’t have it! Let’s say we’re a particularly well capitalised bank, and could afford to lose $100bn before collapsing (by way of comparison, the modest loss of $35bn by the RBS in 2008 was enough to topple that bank, at the time the World’s largest). The log base 2 of 100bn is about 36.5, so after 37 heads in a row we’re already bankrupt. In fact, the payout function looks something more like this:

Now, the states X=0 to X=36 all contribute 1 to the payoff, but the contribution of the remaining states declines with the probability since payoff is capped at our capital reserves. The total contribution of the remaining states will then be

Which is around $1.5. So, a more realistic consideration of our capital position gives a price of around $37.50, much more useful than our initial price of infinity. Of course, the trader would be sensible to charge quite a bit more than this, both to make a profit but also to prevent giving away potentially market-sensitive information about our capital reserves!