Medium | Discrete Maths |

At a party of N people, some have a symmetric friendship. Symmetric means that if A is friends with B, then B is in turn friends with A. Prove that there are at-least two people with same number of friends.

Solution

Source: Top Quant Interview

Enable Like and Comment Medium | Probability |

p and q are two points chosen at random between 0 & 1. What is the probability that the ratio p/q lies between 1 & 2?

Hint

Graph Shading. (Whenever we see two uniform random variables, we graph them up!)

Solution

Assume that the points are x & y. Create x-y graph, and our desired region is the area between lines y=x & y=2x. This region is 1/4th of the rest.

Source: Written Test

Enable Like and Comment Medium | Probability |

Roll a die, and you get paid what the dice shows. But if you want, you can request a second chance & roll the die again; get paid what the second roll shows instead of the first. What is the expected value?

Medium | Probability |

A very innocent monkey throws a fair die. The monkey will eat as many bananas as are shown on the die, from 1 to 5. But if the die shows '6', the monkey will eat 5 bananas and throw the die again. This may continue indefinitely. What is the expected number of bananas the monkey will eat?

Hint

Law of total probability

Answer

4

Solution

This uses law of total probability very silently, i.e., E( E(X|Y) ) = E(X). Suppose X expected number bananas eaten overall and Y = number shown on dice.

E1 = E( X | Y = 1,2,3,4,5) = 3

E2 = E( X | Y = 6) = 5 + E(X)

now, E(X) = 5/6*E1 + 1/6*E2

Solving this simple equation gives E(X) = 4

E1 = E( X | Y = 1,2,3,4,5) = 3

E2 = E( X | Y = 6) = 5 + E(X)

now, E(X) = 5/6*E1 + 1/6*E2

Solving this simple equation gives E(X) = 4

Source: Self, to show an example of recursive probability

Enable Like and Comment Medium | Probability |

What is the expected number of coin tosses required to get n consecutive heads?

Hint

That sum wont work! Just find the recursive relation.

Answer

En = 2En−1 + 2, giving En = 2^(n+1)-2

Solution

Define let Xn = number of tosses to get n consecutive heads; E(Xn) = expected number of coin tosses we require from now on, to get n consecutive heads. Recall the law of total probability,

E(Xn) = E ( E(Xn) |Y) )

where Y = current toss (either Head or tail).

En = (1/2)( E(Xn) | H) + (1/2)( E(Xn) | T)

En = (1/2)( E(X(n-1)) + 1 |H) + (1/2)( E(Xn) + 1 | T)

the extra 1 is because we just used a toss

En = 1 + (1/2)*E(n-1) + (1/2)*En

This above equation is logical and should be written directly.

=> En = 2E(n-1) + 2

This simplifies to 2^(n+1)-2 as E0 = 0. (not required)

E(Xn) = E ( E(Xn) |Y) )

where Y = current toss (either Head or tail).

En = (1/2)( E(Xn) | H) + (1/2)( E(Xn) | T)

En = (1/2)( E(X(n-1)) + 1 |H) + (1/2)( E(Xn) + 1 | T)

the extra 1 is because we just used a toss

En = 1 + (1/2)*E(n-1) + (1/2)*En

This above equation is logical and should be written directly.

=> En = 2E(n-1) + 2

This simplifies to 2^(n+1)-2 as E0 = 0. (not required)

Source: Top Quant Interview

Enable Like and Comment Latest solved Puzzles

Color Switches Weird Sequences Intersecting Pillars Consecutive sums Scaling a Square Difficulty Level

© BRAINSTELLAR |