Wanna be a quant: QuantNet 2012-2013 International Guide to Programs in Financial Engineering

The QuantNet 2012-2013 International Guide to Programs in Financial Engineering have been released! Awesome guide, download it. Check out the table of contents: What do Financial Engineers Do? – Efficient Ways to Set Up a Successful Career – Which Master’s Degree is Right for You? – Do’s and Don’ts of MFE Applications – C++ Programming for Financial Engineering – Hunting the Quant Job: Questions and Answers – Questions Asked at Quant Interviews – Reading List: Books to Help Prepare for Quant Interviews, and more.

Don’t miss the chance to have a look at all the information you can find on QuantNet. For example,  if you deem yourself strong at C++ try their good (and free) C++ on-line tests.

Hats and capricious secretary: a MonteCarlo trick to compute “e”

A popular question on basic probability  appearing in quant job interviews is the classical matching problem described in amusing forms: hats in a check-room are mixed and randomly distributed to the guests; a secretary has mixed a set of letters and their envelopes. What is the probability that no hat will match the right guest? What is the probability that exactly 3 letters will reach the right destination?

The more classical formulation of the same problem is about seeking for a match among two identical decks of N cards randomly mixed. Being A_i the probability that the i^{th} card will match (regardless to other possible matchings!), we have

P(A_i) = \frac{1}{N}\,\,, P(A_iA_j) = \frac{1}{N(N-1)}\,\,, P(A_{i_1}...A_{i_{i_r}}) = \frac{(N-r)!}{N!}
The probability of at least one match is given by
P(A_1\cup A_2 \cup ... \cup A_N)

= \sum_{i=1}^{N} P(A_i)- \sum_{i<j}P(A_iA_j) +...+(-1)^{N-1}P(A_1...A_N)

= 1- \frac{1}{2!}+\frac{1}{3!}-...+(-1)^{N-1}\frac{1}{N!}
Therefore, in the limit of large N the probability approaches 1-1/e , which is a quite surprisingly result. This result can be used to compute the probability of zero matches which is simply 1 minus the probability of at least one match.

From this simple result the amusing idea to try to compute e with a MonteCarlo, just as it is usually done for \pi. Here my Mathematica code which does the job:

MonteCarloNepero[NN_, L_] := Module[{mean, check, indicatorCount},
 indicatorCount = 0;
 check = (# - RandomSample[#]) &@Table[l, {l, 1, L}];
 If[FreeQ[check, 0],
 indicatorCount = indicatorCount + 1;
 , {NN}];
 mean = indicatorCount/NN;

Where NN is the number of MonteCarlo runs and L is the length of the card deck. The convergence in the number of cards is very fast so with L=15 the result is already fair. Far more slow is the convergence in NN… For example we may get

In[2]:= MonteCarloNepero[1000, 15]
Out[2]:= 2.75482

In[3]:= E // N
Out[3]= 2.71828

Not that accurate, but fun.

Wanna be a quant: job interview books reviews

Just updated my Books page with a few lines of review about some popular “Quant job interviews” books.

Well written and useful, as the other Joshi’s books. Many non-trivial questions and original solutions. Interesting and unusual the section about C++ programming.
The classic reference for quant job interviews. On top of the probability-statistics and math finance problems, there is big section on “brainteasers” (I don’t like them…) and a chapter on non-technical questions.
A more mathematical tone with respect the other interview books. Even the brainteasers are non-irritating. Each section of questions is introduced by a quick and clever review of the math that should be used to solve the problems.
Different from all the other interviews books: the FAQ are a good opportunity to jump through different interesting topics. The answers and the references given in the book are the starting point for a further study.