How Many Times on Average?

A common type of questions which appears on Quant Interviews is:

“You have a sequence of random variables. How many times on average does a certain outcome appear in this sequence?”

Here are a few examples:

  1. You are throwing a coin 100 times. How many times will you encounter the Heads-Heads-Tails in this sequence?
  2. Five husbands and five wives have sat around a circle table in random order. What is the average number of spouses which are sitting next to each other?

While such problems can be solved using induction, there is another, more elegant approach. It is based on the following observation:

The average number of successful events is equal to the sum of the probabilities that each of these events is successful. The events do NOT need to be independent.

Written mathematically, this translates to:

\mathbb{E}(\|\{X_i = 1, 1 \leq i \leq n \}\|) = \mathbb{E}(\sum_{i=1}^{n} X_i) = \sum_{i=1}^{n} \mathbb{E}(X_i) = \sum_{i=1}^{n}\mathbb{P}(X_i =1),

where X_i is a random variable, such that X_i=1 if the i-th event is successful X_i = 0 otherwise.

  • The first equation follows from the definition of X_i.
  • The second equation follows from linearity of expectation.
  • The third equality is a basic property of expectation.

Let us see how to apply this technique to solve the coin question posed above.

We define a random variable X_i which is equal to 1 if and only if coin tosses i, i+1, i+2 are Tails-Tails-Heads respectively. We have:

\mathbb{E}(\|\{X_i=1, 1\leq i \leq 100\}\|) = \sum_{i=1}^{100}\mathbb{P}(X_i=1)

It is easy to see that for each 1\leq i \leq n, X_i = \frac{1}{2}\times\frac{1}{2}\times\frac{1}{2}=\frac{1}{8}. Therefore, the answer to the problem is 100\times \frac{1}{8}=12.5.


To solve the second problem, we define a random variable X_i which is equal to 1 if and only a husband and his wife are sitting on spots i and i+1 around the table. For each i the probability of this happening is equal to \frac{1}{9}. Indeed, no matter who sits on spot i, the chance that their spouse sits on spot i+1 is 1:9. Therefore, the average number of spouses sitting next to each other is:

\mathbb{E}(\|\{X_i=1, 1\leq i \leq 10\}\|) = \sum_{i=1}^{10}\mathbb{P}(X_i=1)=10\times\frac{1}{9}=1\frac{1}{9}

As we can see, the presented technique is a simple, but very powerful tool. For extra practice, try to solve this fun puzzle from our blog on your own:

Monkey Type

There are many tools online to test your typing skills. However, one of them is so stylish and functional, that it drives us back to it repeatedly. Monkey Type offers many features and customization options which make it feel like an addicting video game. You can try to climb the leaderboards in various categories by typing as quickly as possible given paragraphs. You can focus on typing punctuation or numbers, or simply practice stress-free using the provided zen mode. Following each session, you will receive a comprehensive report of your typing performance, including words per minute, accuracy, consistency, etc. The interface is simple and polished, but if it is not to your liking, you can always change the theme in the settings menu.

D1G1TAL CHR0N1CLES

“D1G1TAL CHR0N1CLES” by the Georgean duo Levan Patsinashvili and Davit Babiashvili is a series of pictograms depicting major historical events using cleverly designed fonts. The designs are puzzling, educational, and eye-pleasing at the same time. Can you guess what happened in the years 1250, 1912, and 1975 by examining these three images?

Well, the sequence {1, 1, 2, 3, 5} is the Fibonacci sequence, and 1250 is the year the famous mathematician died. The sinking number “1912” hints that this is the year the Titanic crashed, and the funny “97” which resembles the Windows OS logo symbolizes the founding of Microsoft in 1975.

Below, we are presenting Levan and Davit’s entire series, consisting of 52 designs, in chronological order. Which ones are your favorites and how many events can you recognize?

Detective Flanders and the Zodiac Killer

Detective Flanders and the Zodiac Killer is a puzzle story, exclusively created for Puzzle Prime. Every chapter you read contains a puzzle that must be solved in order to continue further.

Here you can find a walkthrough guide to the story, created by andante. Thank you for the wonderful work!

If you need more help, feel free to ask questions and the discuss the puzzles in the comments section. However, please do not share the answers and only stick to hints instead.