# Two different books are giving two different solutions.

So I am solving some probability/finance books and I've gone through two similar problems that conflict in their answers.

## Paul Wilmott

The first book is Paul Wilmott's Frequently Asked Questions in Quantitative Finance. This book poses the following question:

Every day a trader either makes 50% with probability 0.6 or loses 50% with probability 0.4. What is the probability the trader will be ahead at the end of a year, 260 trading days? Over what number of days does the trader have the maximum probability of making money?

Solution:

This is a nice one because it is extremely counterintuitive. At first glance it looks like you are going to make money in the long run, but this is not the case. Let n be the number of days on which you make 50%. After $$n$$ days your returns, $$R_n$$ will be: $$R_n = 1.5^n 0.5^{260−n}$$ So the question can be recast in terms of finding $$n$$ for which this expression is equal to 1.

He does some math, which you can do as well, that leads to $$n=164.04$$. So a trader needs to win at least 165 days to make a profit. He then says that the average profit per day is:

$$1−e^{0.6 \ln1.5 + 0.4\ln0.5}$$ = −3.34%

Which is mathematically wrong, but assuming he just switched the numbers and it should be:

$$e^{0.6 \ln1.5 + 0.4\ln0.5} - 1$$ = −3.34%

That still doesn't make sense to me. Why are the probabilities in the exponents? I don't get Wilmott's approach here.

*PS: I ignore the second question, just focused on daily average return here.

## Mark Joshi

The second book is Mark Joshi's Quant Job Interview Question and Answers which poses this question:

Suppose you have a fair coin. You start off with a dollar, and if you toss an H your position doubles, if you toss a T it halves. What is the expected value of your portfolio if you toss infinitely?

Solution

Let $$X$$ denote a toss, then: $$E(X) = \frac{1}{2}*2 + \frac{1}{2}\frac{1}{2} = \frac{5}{4}$$ So for $$n$$ tosses: $$R_n = (\frac{5}{4})^n$$ Which tends to infinity as $$n$$ tends to infinity

Uhm, excuse me what? Who is right here and who is wrong? Why do they use different formula's? Using Wilmott's (second, corrected) formula for Joshi's situation I get the average return per day is:

$$e^{0.5\ln(2) + 0.5\ln(0.5)} - 1 = 0%$$

I ran a Python simulation of this, simulating $$n$$ days/tosses/whatever and it seems that the above is not correct. Joshi was right, the portfolio tends to infinity. Wilmott was also right, the portfolio goes to zero when I use his parameters.

Wilmott also explicitly dismisses Joshi's approach saying:

As well as being counterintuitive, this question does give a nice insight into money management and is clearly related to the Kelly criterion. If you see a question like this it is meant to trick you if the expected profit, here 0.6 × 0.5 + 0.4 × (−0.5) = 0.1, is positive with the expected return, here −3.34%, negative.

So what is going on?

Here is the code:

import random
SIM = 10**5 # Number of times to run the simulation
ret = 0.0
for _ in range(SIM):
curr = 1 # Starting portfolio
for _ in range(n_tries): # number of flips/days/whatever
if random.random() > p_win:
curr *= win_ratio # LINE 9
else:
curr *= loss_ratio # LINE 11

ret += curr # LINE 13: add portfolio value after this simulation

print(ret/SIM) # Print average return value (E[X])


Use: traderToss(260, 0.6, 1.5, 0.5) to test Wilmott's trader scenario.

Use: traderToss(260, 0.5, 2, 0.5) to test Joshi's coin flip scenario.

Thanks to the followup comments from Robert Shore and Steve Kass below, I have figured one part of the issue. Joshi's answer assumes you play once, therefore the returns would be additive and not multiplicative. His question is vague enough, using the word "your portfolio", suggesting we place our returns back in for each consecutive toss. If this were the case, we need the geometric mean not the arithmetic mean, which is the expected value calculation he does.

This is verifiable by changing the python simulation to:

import random
SIM = 10**5 # Number of times to run the simulation
ret = 0.0
for _ in range(SIM):
if random.random() > 0.5:
curr = 2 # Our portfolio becomes 2
else:
curr = 0.5 # Our portfolio becomes 0.5

ret += curr

print(ret/SIM) # Print single day return


This yields $$\approx 1.25$$ as in the book.

However, if returns are multiplicative, therefore we need a different approach, which I assume is Wilmott's formula. This is where I'm stuck. Because I still don't understand the Wilmott formula. Why is the end of day portfolio on average:

$$R_{day} = r_1^{p_1} * r_2^{p_2} * .... * r_n^{p_n}$$

Where $$r_i$$, $$p_i$$ are the portfolio multiplier, probability for each scenario $$i$$, and there are $$n$$ possible scenarios. Where does this (generalized) formula come from in probability theory? This isn't a geometric mean. Then what is it?

• Take a more extreme example: each day you you either quadruple your funds or you lose everything, with equal probability. After $n$ days, your expected funds are $2^n$ times your original stake, and this is increasing rapidly, but the probability you have any money at all left is $\frac{1}{2^n}$ and this is falling rapidly. – Henry Jul 6 at 8:37
• They are different problems, and you ask multiple different questions about them. So it's a little hard to tell where to start with unravelling it all. But you also say that Wilmott says: profit per day is: $1−\mathrm{e}^{0.6\ln 1.5+ 0.4 \ln 0.5} = −3.34%$" and that he says: "the expected profit, here 0.6 × 0.5 + 0.4 × (−0.5) = 0.1, is positive". Does he really say both?? – T_M Jul 6 at 8:57
• $\mathrm{e}^{0.6\ln 1.5+ 0.4 \ln 0.5} \approx 0.9666$ is in a sense the weighted geometric mean outcome while $0.6\times 1.5+ 0.4 \times 0.5=1.1$ the weighted arithmetic mean outcome, with the weights being the probabilities. You might subtract $1$ from each for a measure of the gain, but if you have $n$ repeated applications, then you in fact want to raise each of these to the power of $n$ before subtracting the $1$. – Henry Jul 6 at 9:28

Joshi's problem is a much easier problem and he is correct. Wilmott's problem is a little bit more subtle, and I think he is misleading about what he is computing. The main point is that returns are not additive, so the trap is to compute expectation of the return on a given day and then "add it up" to conclude that you are expected to win overall. It's counterintuitive that this does not work.

So Wilmott is correct when he says that the expected profit on day 1 is $$0.6 \times (1.5 - 1) + 0.4 \times (0.5 - 1) = 0.1.$$ If we write $$X$$ for the return on day 1, then: $$\mathbb{E}(1+X) = 0.6 \times 1.5 + 0.4 \times 0.5 = 1.1.$$

I think Wilmott's language is misleading for the newcomer (which is annoying as he's supposed to be famous for teaching basic quant principles to newcomers). By "average profit per day" in the sentence you quote he seems to be referring to something like "expected daily rate of profit". To shed a bit more light on what he means, suppose you want to compute the expected return after $$n$$ days: To do this, let $$X_1,\dots, X_n$$ be i.i.d. random variables where $$X_k$$ is defined as the return on day $$k$$. These are not additive: The return after $$n$$ days is given by the random variable $$R_n = (1+X_1)(1+X_2)\cdots (1+X_n)$$. But log-returns are additive: $$\log R_n = \sum_{i=1}^n \log (1+X_i),$$ so that by linearity of expectation (and i.i.d. assumption) we can compute the expectation of the log-return now as: $$\mathbb{E}(\log R_n) = n \mathbb{E}(\log (1+X)) = n\Bigl(0.6 \log 1.5 + 0.4 \log 0.5\Bigr).$$ So you can see that what matters in the long run for the expected log-return is the whether the expression in the brackets on the right-hand side is bigger than zero or not.

Wilmott seems to use the value of $$e^{\mathbb{E}(\log R_1)} - 1 = e^{(0.6 \log 1.5 + 0.4 \log 0.5)} - 1$$ to make the same point I am making above. But since we've taken an expectation, we can't pull the $$\mathbb{E}$$ through a logarithm or exponential to "convert" easily back to $$\mathbb{E}(R)$$. I don't know... this might be one of this quant things that is used as a measure of rate of return but isn't the same as $$\mathbb{E}(R)$$.

• I can't agree with you more about Wilmott. His book is horrible. Really good questions, but really half-assed solutions. Back to the question, in your $\log R_n$ formula you never bring up the probability factor. How does the weighted geometric factor into this formula? – QuantumHoneybees Jul 6 at 11:56
• I'm not sure what you mean about the probability factor, the equation for $\log R_n$ is arrived at by just manipulating the random variables themselves.Then when you take the expectation, you need to use the probability distribution of $X$. – T_M Jul 6 at 12:04
• Oh my bad, I misread. Yeah now I get it. Not sure which answer to accept as this question has been answered real well by everyone. I think your answer helped the most though since it addressed the author's logic, so I'll be accepting this – QuantumHoneybees Jul 6 at 12:06

The difference is that a $$50$$% loss and a $$50$$% gain (in either sequence) result in a net loss (AM-GM inequality), whereas halving and doubling (in either sequence) do not result in a net loss. Joshi is presenting (and solving) a different problem, one in which half the time the trader's expected return is $$100$$%. So there's no a priori reason to expect the same result.

Having said that, Wilmott's answer to the Joshi question is wrong. For $$n$$ tosses, $$R_k=2^k(\frac 12)^{n-k}=2^{2k-n}$$, where $$k$$ is the number of times you toss heads. Wilmott's analysis of Joshi assumes that you are starting afresh each time with a single dollar.

Wilmott's solution to his own problem is correct. If you take ten trials, you expect a return of $$1.5^6 \cdot 0.5^4 -1 = \frac{729}{1024}-1 = -\frac{295}{1024}$$. Taking the geometric mean gets you $$\sqrt{1.5^6 \cdot 0.5^4} -1 = 1.5^{0.6} \cdot 0.5^{0.4}-1$$, which is exactly what Wilmott says (just writing it in exponential form).

• Well isn't a 50% loss the same as halving? And a 50% gain the same as multiplying by 1.5? – QuantumHoneybees Jul 5 at 23:50
• I also am not familiar with the AM-GM inequality, so maybe this is part of the reason? – QuantumHoneybees Jul 5 at 23:52
• If your “position doubles,” you have made 100%, not 50%. – Steve Kass Jul 6 at 0:18
• Joshi says that $50$% of the time "your position doubles." I do agree with you that the solution given for the Joshi problem is wrong, though. I'll edit my answer to note that. – Robert Shore Jul 6 at 0:41
• If you find an answer useful, upvotes and acceptances are always appreciated. – Robert Shore Jul 6 at 0:48

They’re computing two entirely different things. Wilmott is computing the minimum number of days out of $$260$$ on which you must make a profit in order to come out ahead; Joshi is computing the expected value of your portfolio. Applying Joshi’s calculation to Wilmott’s setting, we get an expected value after $$260$$ days of

$$(0.6\cdot1.5+0.4\cdot0.5)^{260}=1.1^{260}\approx 57,833,669,934\;.$$

Wilmott’s calculation does not take the probabilities of the two outcomes into account: it would yield the same result whether you made a $$50\%$$ profit with probability $$0.99$$ or with probability $$0.01$$. In the former case, however, you are almost certain to make a net profit, while in the latter you are almost certain to lose virtually everything. No matter what the probabilities are, you need to make a profit on at least $$165$$ days in order to come out ahead for the year; your likelihood of actually doing so, however, changes greatly with the probabilities.

In the original problem you might find it odd that the expected number of days on which you make a profit is $$60\%$$ of $$260$$, or $$156$$ days, and you lose money if you make a profit on exactly $$156$$ days, yet your overall expected value is enormous. This is because once you reach the break-even point, your expected final value grows explosively as the number of profitable days (out of $$260$$) increases, and these huge profits more than compensate for the more likely losses.

If you want to know how likely it is that you’ll make a profit, you want Wilmott’s calculation; you can then plug the figure of $$165$$ days into a binomial distribution calculator and find that the probability of making a profit on at least $$165$$ days is only about $$0.14$$. The fact that the expected profit — expected in the mathematical sense, that is — is considerable would probably not be very comforting, since it results from the fact that relatively unlikely outcomes produce huge profits.

The crucial thing is that Wilmott asks about the chance of making a profit, regardless of how large the profit or loss is. Joshi is asking about expected value of the portfolio. Those are very different questions. If I pay $$1$$ to bet on something and win $$10$$ with probability $$\frac 15$$ but can only play once, Wilmott says I should not. I lose $$80\%$$ of the time. Joshi says I should play, because my expected return is $$2$$. They are asking different questions and getting different answers.

The answer by Brian M. Scott shows the main effect at work: In the Wilmot scenario, the expected value after 260 trading days is enourmous, but the probability of it actually being higher than the starting value is small. That's not at odds with each other, it' s how the expected value works when you can in theory make enourmous gains.

Wilmot does make an error however when he calculates the average profit per day, where you don't understand the formula. I'll try to show how he got there, and where the error was:

If you run his scenrio for $$k$$ days, then the number of "good days" (where you make $$50\%$$) is a random variable $$G_k$$, and the number of "bad days" (where you loose $$50\%$$) is also a random variable $$B_k$$. Both variables follow a binomial distribution (Bin), where $$G_k \sim \text{Bin}(k,0.6)$$ and $$B_k \sim \text{Bin}(k,0.4)$$.

Now, Wilmot correctly uses the fact that the value of the return after $$k$$ days is

$$R=1.5^{G_k}0.5^{B_k}.$$

You can find this in his formula

$$R_n=1.5^n0.5^{260-n},$$

because this talks about the $$260$$ trading days scenario (so $$k=260$$) and he defined $$n$$ to be the number of good days you have (so $$n=G_{260}$$). This shows that that first terms ($$1.5$$ to the power of something) are the same in both formulas. Also, we have $$G_k+B_k=k$$ (each day is either good or bad), so $$B_{260}=260-G_{260}=260-n$$, which shows that the secnd terms ($$0.5$$ to the power of something) are also the same.

Again, up to here everything is correct. We have $$R=1.5^{G_k}0.5^{B_k}$$, so $$R$$ is also a random variable. Now we know what the expected values of $$G_k$$ and $$B_k$$ are, for a binomial distribution that's easy to calculate:

$$E(G_k)=0.6k,\, E(B_k)=0.4k.$$

The error, I assume, that they did was to use the above correct formulas and incorrectly conclude that

$$E(R)\overset{\color{red}{\text{wrong}}}{=}1.5^{E(G_k)}0.5^{E(B_k)}=1.5^{0.6k}0.5^{0.4k}=\left(1.5^{0.6}\times0.5^{0.4}\right)^k.$$

The last part of the formula seems to show that the return changes by a factor of $$1.5^{0.6}\times0.5^{0.4} = e^{0.6\ln(1.5)+0.4\ln(0.5)} \approx 0.9666$$ each day, which corresponds to the $$3.34\%$$ loss per day they calculated.

The error here is that if $$f(x)$$ is any non-linear function, then if $$X$$ is a random variable then generally

$$E(f(X)) \neq f (E(X))$$

• So if I were tasked to find the expected value of this scenario after 260 days, Joshi's answer is the correct one? – QuantumHoneybees Jul 6 at 11:52
• Right, it is $1.1^{260}$ times the original amount. – Ingix Jul 6 at 11:54