DEV Community

Aashish Chaubey 💥⚡️
Aashish Chaubey 💥⚡️

Posted on

Boy or Girl Paradox... What the heck is it??? 🤯🤷

Hi friends,

I am a machine learning and data science enthusiast. I love playing with numbers and finding insights. I know many of you are, at least to some level. Even if you are not but you have some level of interest in mathematics, there is a great chance you will find this post interesting.

Please let me know if you guys already knew this and if there are many more which I should check out, please let me know in the comments belows. I encourage all my fellow reader to read them too.


I like solving problems, sometimes I find it on renowned platforms like Kaggle and hackerearth. Randomly I came across this seemingly easy question but which blew my mind off [partly because I feel this problem is not articulated well!]

Hackerrank Problem

I thought I didn't have to think much about it. Because it is just so straight forward. I mean it is given that one child is a boy, only probability of the other child being a boy is 1/2 [unless otherwise stated].

I selected the 1/2 answer from the answer, it was a wrong one. Okay, it needed a little more thinking. I wrote down all the possibilities at least one of the child is a boy [we are already given this information].

[BB, BG, GB]
Enter fullscreen mode Exit fullscreen mode

Therefore, another answer which is also equally likely according to the question is 1/3. And as it turns out, this indeed is a correct answer.

But how can we have two equally correct answers for this. In my view, both the answers, as per the problem statement is correct.

I took to Google for adjudication, and again, Google didn't disappoint. Look what I found:

The Boy or Girl paradox surrounds a set of questions in probability theory, which are also known as The Two Child Problem, Mr. Smith's Children and the Mrs. Smith Problem. The initial formulation of the question dates back to at least 1959, when Martin Gardner featured it in his October 1959 "Mathematical Games column" in Scientific American. He titled it The Two Children Problem, and phrased the paradox as follows:

  • Mr. Jones has two children. The older child is a girl. What is the probability that both children are girls?
  • Mr. Smith has two children. At least one of them is a boy. What is the probability that both children are boys?

I think it is a good read. I suggest you all to go through it (if you already haven't).


Just wanted to share this information to this erudite community. Please feel free to reach out to me on:

Twitter: https://twitter.com/AashishLChaubey
LinkedIn: https://www.linkedin.com/in/chaubey-aashish

Please checkout my Github

Discussion (8)

Collapse
darkwiiplayer profile image
DarkWiiPlayer

Intuitively, I also wanted to say 1/2, because if one is a boy, there's only one 50/50 change, right?

But if you rephrase the question as "Of all families with 2 children, of which at least one is a boy; how many have two boys?" the answer becomes a bit easier: it's 1/3, because there's 3 possible combinations (boy girl, girl boy and boy boy), only one of which is the one we're looking for.

Collapse
mr_eking profile image
Eric King

Counter argument: "boy girl" and "girl boy" are the same option, since there's no reason to distinguish by birth order (or any characteristic other than gender).

I think it would be correct to say that there are 3 possible options: "both boys", "both girls", and "one of each". Since the "both girls" option is impossible, you are left with only two possible options: "both boys", or "one of each". Answer: 1/2

Collapse
darkwiiplayer profile image
DarkWiiPlayer

You'd think so, but no, you're still wrong. Think of it this way: Before even filtering out the option with two girls: you have four possible permutations: BB, BG, GB and GG; each of them has a chance of 1/4.

It's twice as likely to have a boy and a girl as to have either two boys or two girls. Put differently: there's a 50/50 chance that the genders match.

If you now remove one of the options (two girls), you're still left with a 2 in 3 chance that they're one boy and one girl.

You can even do an experiment: Write a simple program that does coin tosses, and repeatedly throw pairs of two coins. Then pick one side and filter out all the results where both coins landed on that side. You'll roughly end up with two thirds of the pairs being different sides.

Collapse
aashish profile image
Aashish Chaubey 💥⚡️ Author

You are correct, and that's what I mean, this question is left for open interpretation. You could literally interpret in multiple ways.

Collapse
darkwiiplayer profile image
DarkWiiPlayer

Here's the smartass answer: 0%. The question states one of them is a boy, so the other is a girl. HA!

Collapse
nicolus profile image
Nicolas Bailly

If you don't know it already, check out the Monty Hall problem, you're in for a treat !

en.wikipedia.org/wiki/Monty_Hall_p...

Collapse
darkwiiplayer profile image
DarkWiiPlayer

One of my favourite problems, because it just seems sooooo counter-intuitive. However, as I found out, it seems much more obvious to me if you consider it with 100 doors:

Pick 1 door of a hundred. What are the chances you're right? very low.

Now 98 doors are opened, and you're given the chance to switch to the other one. Now it suddenly seems very clear that you should switch.

Collapse
aashish profile image
Aashish Chaubey 💥⚡️ Author

This is interestingl, Thanks Nicolas!