Give two boxes **B1** and **B2** one have **50** red marbles and other have **50** blue marbles. A ball is selected randomly from any of the box and the task is to maximize the probability of selecting a red ball, by reshuffling marbles in both the boxes.

**Solution:**

Let **P(R)** be the probability of picking a red marble.

P(R) = P(B1) * P(B1 | J1) + P(B2) * P(B2 | J2)

Here, **P(B1)** and **P(B2)** refers to selecting **B1** and **B2** and the probability of selecting each box is **J1** and **J2** refers to number of total balls in **B1** and **B2** respectively.

If we do not reshuffle any balls. Then

P(R)= ((1 / 2) * 1) + ((1 / 2) * 0) = 0.5

But, If we decrease the number of red balls in box B1 and increase the number of red balls in box B2 then the probability of getting a red ball will be maximized.

Therefore, let us take 49 red marbles from B1 to B2 then there will be 1 red ball in B1 and 99 balls in B2 out of which 49 are red and 50 of them are blue in the second jar.

Then

P (R)= ((1 / 2) * (1 / 1)) + ((1 / 2) * (49 / 99)) = 0.747474

Hence,

the maximum probability of choosing a red ball is

0.747474

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Puzzle 47 | Red Hat vs Blue Hat
- Puzzle 52 | Boy with Marbles
- The Blue – eyed Island puzzle
- Puzzle | Cut Blue Painted Cube
- Puzzle | 9 Students and Red Black Hats
- Puzzle 13 | (100 Prisoners with Red/Black Hats)
- Puzzle 15 | (Camel and Banana Puzzle)
- Puzzle 34 | (Prisoner and Policeman Puzzle)
- Puzzle 51| Cheryl’s Birthday Puzzle and Solution
- Puzzle | 3 Priests and 3 devils Puzzle
- Puzzle 24 | (10 Coins Puzzle)
- Puzzle 27 | (Hourglasses Puzzle)
- Puzzle 28 | (Newspaper Puzzle)
- Puzzle 29 | (Car Wheel Puzzle)
- Puzzle 31 | (Minimum cut Puzzle)
- Puzzle 33 | ( Rs 500 Note Puzzle )
- Puzzle 36 | (Matchstick Puzzle)
- Puzzle 38 | (Tic Tac Toe Puzzle)
- Puzzle 39 | (100 coins puzzle)
- Puzzle 81 | 100 people in a circle with gun puzzle

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.