## Red and Blue Marbles Puzzle (Interview Puzzle)

###### 1 year ago codedestine 0

**Red and Blue Marbles Puzzle :-** You have given 50 red marbles, 50 blue marbles and two empty jars. You have to put all the 100 marbles into the jars, such that when you randomly pick one marble from any of the jar, probability of it’s being a red color marble is maximum. How will you do that ?

## Now try to solve this on your own…

## Solution of Red and Blue Marbles Puzzle :-

Let’s name each jar for easy understanding, first jar as A and second jar as B.

**Case 1 :-** Let’s put 25 of each color marble in a jar and calculate the probability of picking red marble.

**A -> 25 red marbles + 25 blue marbles**

**B -> 25 red marbles + 25 blue marbles**

Let’s calculate the total probability by using this formula :-

**Probability of picking Red Marble = ( Probability of selecting Jar A * Probability of picking Red Marble from Jar A ) + ( Probability of selecting Jar B * Probability of picking Red Marble from Jar B )**

P ( Red Marble ) = P ( Jar A ) * P ( Red Marble in Jar A ) + P ( Jar B ) * P ( Red Marble in Jar B )

P ( Red Marble ) = 1/2 * 25/50 + 1/2 * 25/50

P ( Red Marble ) = 0.50

So probability of picking red marble is** 50%**.

As you can see 50% probability is not a high probability. If you put all red marbles in one jar and all blue marbles in other jar, you will get the same probability. So we have to think a better way to distribute the marbles.

**Case 2 :-** Let’s put 1 red marble in jar A and all other marbles (49 red marbles and 50 blue marbles) in jar B and calculate the probability of picking red marble.

**A -> 1 red marble**

**B -> 49 red marbles + 50 blue marbles**

Let’s calculate the total probability :-

P ( Red Marble ) = P ( Jar A ) * P ( Red Marble in Jar A ) + P ( Jar B ) * P ( Red Marble in Jar B )

P ( Red Marble ) = 1/2 * 1 + 1/2 * 49/99 = 0.5 + 0.24

P ( Red Marble ) = 0.74

So probability of picking red marble is **74%**.

This is one of the optimal solution for this problem, if you can come up with a better solution feel free to comment.

That’s all for Red and Blue Marbles Puzzle, If you liked it, please share your thoughts in a comments section and share it with others too. For more interesting puzzles visit Interview Puzzles.