64 comments

[ 3.2 ms ] story [ 122 ms ] thread
I chose to answer the question empirically. http://pastebin.com/1g1bAEPt Turns out it's equal.
While that's a nice way to approach a mathematical problem, it does not take into account the social aspects of the problem. For example, it used to be (and perhaps still is?) quite common for families to aspire to have a boy and therefore have another child when they have a girl, but not when they have a boy.

Interestingly, these sort of things are much easier to model empirically the way you did (all you would need is a small tweak to the "haveAKid" condition in the while loop around line 35), whereas the math gets pretty complicated fast.

Well, it was posted in probability and not is some social science board. So I thought it was safe to assume a purely mathematical question. Not that I can answer it...
Yeah, I wrote that after staring at it for a few minutes, and giving up any pretense that I could model it with confidence.
Social and biological aspects. Assume there may be some genetic factor which makes it impossible(or even just less equal-odds) for a pair to produce a female, or male. If that's the case, men will on average have more brothers than women do.
I think you forgot to put quotes around "Girl" on line 46. Edit: Actually I'm not sure what the problem is but I'm getting 0 girls and a divide-by-0 error.

Edit2: I don't remember why I was getting all girls, but the other issue was integer division. If boybrothers/boys truncates to 0, then (girlbrothers/girls)/(boybrothers/boys) will divide by 0.

Actually, line 46 is referencing the class Girl, so you wouldn't want quotes. Technically, you're supposed to use try/except duck-typing in Python, but I often find that clearer code comes out of assertions where you literally check the type of an object instead of handling errors. This was no exception. (Sorry, bad pun)

You might try throwing in a random seed. I just trusted that my system would iterate enough that it wouldn't matter, but if you're getting all boys (I'm not sure that's the case, but you said that you're getting 0 girls...), it could be that for whatever reason, the system might not be advancing the seed. Try inserting the following two lines immediately after import random:

from datetime import datetime

random.seed(datetime.now())

Run it in Python 3.
Yeah in hindsight that was pretty obvious. I guess the real bug was leaving off the #! line :)
I'm surprised you managed to make it that complicated! http://pastebin.com/fck8qkMc
I like your solution! Good use of iter().

You actually bring up an interesting question of design philosophies. I thought that the script that I posted was extremely explicit, and therefore clear. Yours is far more terse, and implicit, which means that there's less to understand, but there is some onus on the reader to decode what is happening.

I'm not sure which is better, as a policy. Obviously, solving problems with fewer lines is desirable, but it's also good to make solutions that are intrinsically obvious.

It is as they say: every problem can be solved with an additional level of indirection... except the problem of too many levels of indirection.
Classic stack overflow, top answer is a giant mass of "look how awesome I am!"

sensible answer is 3 down with half as many upvotes.

That's one of my productivity secrets. Always read the top 4 answers before deciding on a course.

Answer #3 is right far too often for my liking. And sometimes answer #4 brings up corner cases the others missed.

I think the above structure is eerily reflected in large corporations and in government. The actual work/know-how resides in tier 3 and 4, with the top two tiers actually just being better at politics and self promotion.
(comment deleted)
Glad I scrolled down far enough to find this comment
And of course, the "look how awesome I am" answer isn't useful at all, because there are unproven assertions made to make the question tractable, and unknown realities not brought into the problem space(for example, people having genetic predispositions towards birthing sons rather than daughters, or vice versa)
Why is three better? In any family with k brothers, each male will have k-1 brothers, while each female (if any exist) will have k brothers. So the number of brothers in S(x) is gender dependent, despite the the third answer's claim that it isn't.
> Why is three better?

Because you're wrong.

What a great example of a seemingly simple question that can't be answered.

The question sounds like an elegant and abstract question straight out of a mathematical textbook, but to answer it you need to start making assumptions about the the distribution of family sizes, which leads you to family planning and cultural differences. There is no way to solve this problem on a napkin.

Why does everyone try to solve this problem from first principles? The best way to solve this problem would be to look at actual statistics!

So now I wonder: Is there any publicly available census data that's detailed enough to answer this question? Or are there any public genealogical databases that might be helpful in answering this?

> Why does everyone try to solve this problem from first principles?

Trying to solve the problem from first principles is probably how a lot of the posters came to the conclusion that it wasn't possible. If the problem were possible to solve from first principles, it would have been a waste of time to find/create data, so trying to solve it from first principles is the correct approach given no prior knowledge of the answer.

Come on now - thought experiments about the sex of children always ignore the real world complications that make them different from a coin flip (stopping conditions, genetic predisposition, environmental effects, etc.). And after making those standard thought experiment assumptions, the problem is 100% napkin-worthy.
Seems like a straightforward Gambler's Fallacy situation. Assuming the chances of each sex are independent and equally probable, then each subsequent child has a 50% chance of each sex. Your previous streak is irrelevant (it doesn't matter whether you're male or female), the chance of having a brother is equal. As the number of families approaches infinity the number of brothers will even out.

Or to rephrase the question - after flipping a coin and getting 50 heads in a row, what's the chance of the 51st coin coming up heads? (answer: 50%)

Now in reality the chances of each sex may not be equal - some people have a genetic predisposition to have more sons than daughters or vice versa. And of course there's family planning and so on that may artificially alter the number of brothers/sisters (eg to carry on the fmaily name).

https://www.sciencedaily.com/releases/2008/12/081211121835.h...

Many people really want either a son or a daughter. So they'll keep trying until it works. An acquaintance of mine had four sons before the fifth one finally was a daughter.

I'm pretty sure that effect is a lot stronger than any genetic predispositions.

My mom was one of four daughters (no sons), their mom was one of three daughters (no sons), two of my cousins only have girls, and my sister only has girls... my brother is the only one of myself and cousins that have any sons.
Actually, if everyone has babies of sex A until you have a baby of sex B, you get a 50/50 mix.

  - Half the parents will have an only child of sex B.
  - One quarter will have one A, one B.
  - One eighth will have A, A, B.
  - One sixteenth A,A,A,B.
This converges on 50/50!
Well if you assume some sort of practical limit to the number of children a couple can have, then you end up with more B.
Actually, no. If you have a hard limit, then some people will end up A,A, ... A with no B. That evens it up again.
That's true, but it doesn't imply boys and girls have the same number of brothers. As a commenter in the op pointed out, if families keep having children until they have a son, no boys have any brothers and all girls have exactly one brother. I think if they keep having kids until they have a girl, though, for gors and boys you have a .5 chance no brother, .25 1 brother, and so on.
If you kept flipping coins until you got heads - would you then beat the casino on average?
But by the wording, however, it seems different. (I really, really suck at this stuff though.) If I have 50 men and 50 women in a family, the men each have 49 brothers, and the women each have 50. The coin-flip comparison would be "how many heads are there not counting a particular head" or something.
By assuming a starting family with equal numbers of males and females, you bias the result. You have to look at the distribution of all families. In families with similar numbers of boys and girls, the girls with have more brothers. But in families with significantly more of one gender, the boys will, on average, have many more brothers. When you combine all possible families of a given size, weighted by their likelihood, you find that males and females have the same number of brothers on average. (You can test this pretty easily with the n=1 and n=2 cases, and with a bit of work for the n=3 case.)
Very cool- thank you for getting me to think about this. I get your results if you answer the question for any given sibling group (say, M M F, for example)

  Number of male brothers of males = 1 each * 2 Males = 2
  Number of male brothers of females = 2 each * 2 Females = 2
and proceed to add all of those. In other words, if you weight the count by the number of siblings that have that count.

If you just add up, for any group, how many brothers a female in that group has vs how many brothers a male in that group has, then the females win. In the case above, for example, males have 1 brother, females have 2. So, said another way, odds are that a given female has more brothers than a given male.

But your argument led me to a result that was not at all intuitive (for me)- which is very cool.

In any given family of siblings that has both boys and girls, by definition the females will have more brothers than the males, yes. But it doesn't follow that "odds are that a given female has more brothers than a given male". The reason is that not all families have both. Families with multiple boys and no girls will bring the average up for boys. Families with multiple girls and no boys will bring it down for girls. The end result is that any given person has the same expected number of brothers as any other.

That also makes sense if you think about it intuitively. As the best (IMO) answer to the SO post put it:

"I'll write p for the gender ratio, i.e. the proportion of all people who are men. In real life p is close to 0.5, but this doesn't make any difference. In any random set of n persons, the expected (average) number of men is n⋅p.

1. Take an arbitrary child x, and let n be the number of children in x's family.

2. Let S(x) be the set of x's siblings. Note that there are no gender-related restrictions on S(x): It's just the set of children other than x.

3. Obviously, the expected number of x's brothers is the expected number of men in S(x).

4. So what is the expected number of men in this set? Since x has n−1 siblings, it's just (n−1)⋅p, or approximately (n−1)÷2, regardless of x's gender. That's all there is to it."

Hm... I'm not sure you're answering the correct question.

Assume you're a man and you have a sister. Your next sibling is about to be born.

There is a 50% chance that it's a boy! In which case, he will have one brother (you), you will have one brother (him), and your sister will have 2 brothers. She wins.

There is a 50% chance that it's a girl! In which case, both she and your other sister will both have 1 brother (you), whereas you won't have any. You loose again!

"Assume you're a man and you have a sister."

You just put your finger on the scale. All you can assume is that you're a man, not that you have a sister.

4 siblings... 2 boys, 2 girls... 50/50...

The girls each have 2 brothers...

The boys each have 1 brother.

6 siblings, 3/3... 8 siblings, 4/4... etc

The problem is that you're not considering all the other cases. Here are the possibilities with 2 siblings:

    Gender:     B,B  B,G  G,B  G,G
    # brothers: 1,1  0,1  1,0  0,0
Average # of brothers for boys: 0.5

Average # of brothers for girls: 0.5

You can see that in the families with a mix of boys and girls, the girls do indeed have more brothers. But this is balanced out by the families with more (or in this case all) of one or the other.

Sure. Limit families to four children.

There's one way to have zero daughters. In BBBB, each of the four boys has 3 brothers. Score 12 for the boys here.

There's four ways to have one daughter. In each of them, she's got 3 brothers, while the 3 boys each have 2 brothers. Score 12 for the girls, 24 for the boys.

There's six ways to have two daughters. In each of them, the 2 girls each have 2 brothers, while the 2 boys each have 1 brother. Score 24 for the girls, 12 for the boys.

There's four ways to have three daughters. In each of them, the 3 girls each have one brother, and the boy has none. Score 12 for the girls, zero for the boys.

There's one way to have four daughters, but obviously nobody has a brother.

Add up the scores, and you'll see a tie at 48.

(EDIT: Bogus expected value removed after re-reading.)

My question is: does the ratio of famale-to-male matter? What if the chance of a girl was 60% and male was 40%? My intuition is that it wouldn't, but I'm not sure.
If the simple model is in exact equipoise then the more complex considerations become very important for answering the question. If the a model taking into account all the complexities was still in equipoise than it would come down to noise. It is very unlikely that of the roughly 7 billion people on the planet the women have exactly as many brothers as the men. There's an empirical answer here.
(comment deleted)
With the assumptions that 1) boy/girl is always random but 50/50, and 2) people are choosing to have 1-10 kids ahead of time and going for it (that's how people plan their families, right?), girls do have very slightly more brothers than boys.

The notebook below shows a simulation of 50k towns of 100 families. It also holds for different max numbers of children and more families.

https://gist.github.com/rcarneva/7baac666bd65f487df73378a90c...

> that's how people plan their families, right?

That's probably how they begin planning them, but plans change. Also, there's likely quite a few unintended births.

Or, the alternative reply, if you prefer:

You sarcasm is far too understated to do well on a forum like this. ;)

(comment deleted)
Nice, it took me a while to find the fallacy. (I really hope you did that deliberately, it's masterly.) What you have done is a variant of the observation that within any family the sisters have more brothers than the boys, except that you averaged over 100 families to make the effect more subtle.

But if you make the towns larger, the discrepancy will disappear (for example at 100 towns of 50k families I would expect it to be lost in the noise).

(comment deleted)
my favorite... "it's unclear whether the question even makes sense"
I've often wondered if a certain restaurants is has more groups or individuals dining - this seems pretty similar.
The question was phrased ambiguously as "do men or women have more brothers." Here's three possible interpretations.

One interpretation is "if I am the last born (or some other gender-neutral specifier), do I have more brothers if I am a man or a woman?" As paulmd answers, the chances are even.

But we can also interpret it at the aggregate level. Say we have a family with M men and W women, and we decide to count brothers by polling each person for how many brothers they have, and totaling the result up. If we poll men, we get M(M-1) brothers, and if we poll women, we get MW brothers. The result depends on the distribution, but at the expectation value (M = W), women have more. Same conclusion if we average instead of sum.

The third, most natural interpretation is to "deduplicate:" ask each person to list his or her brothers, take the count of the union. This is the familiar sense: we would say there are three Brontë Sisters, even though none of them individually had three sisters. Here the number of brothers equals the number of men, except when then there's only one man; then each women has 1 brother and each man has 0.

(comment deleted)
> I think women have more as no man can be his own brother

The obvious rebuttal: no woman can be her own brother either.

(comment deleted)
Like tempestn noted in another comment, enumeration is straightforward for small families, and makes it crystal clear that for any family size N, boys and girls have the same average number of brothers:

  Gender:     B  G
  # brothers: 0  0
  B avg # brothers: 0
  G avg # brothers: 0

  Gender:     B,B  B,G  G,B  G,G
  # brothers: 1,1  0,1  1,0  0,0
  B avg # brothers:     (2 + 0 + 0) / (2 + 2) = .5
  G avg # brothers: (0 + 2 + 0) / (2 + 2) = .5

  Gender:     B,B,B  B,B,G  B,G,B  G,B,B  B,G,G  G,B,G  G,G,B  G,G,G
  # brothers: 2,2,2  1,1,2  1,2,1  2,1,1  0,1,1  1,0,1  1,1,0  0,0,0
  B avg # brothers:     (6 + 6 + 0 + 0) / (3 + 6 + 3) = 1
  G avg # brothers: (0 + 6 + 6 + 0) / (3 + 6 + 3) = 1

  Gender:     B,B,B,B  B,B,B,G (x4)  B,B,G,G (x6)  B,G,G,G (x4) G,G,G,G (I collapsed the different permutations here)
  # brothers: 3,3,3,3  2,2,2,3       1,1,2,2       0,1,1,1      0,0,0,0
  B avg # brothers:     (12 + 24 + 12 + 0 + 0) / (4 + 12 + 12 + 4) = 48/32
  G avg # brothers: (0 + 12 + 24 + 12 + 0) / (4 + 12 + 12 + 4) = 48/32
In a family of N children, both boys and girls will have, on average, (N-1)/2 brothers.

Arguments for unequal results are slipping in assumptions that make the observed distribution different from the enumerated one.

It's an exercise for the reader to prove that this equality holds for higher N, it's quite easy (the way I formatted the arithmetic shows how to match up terms).

You are assuming that for a family of N kids, each permutation is equally likely. As others have pointed out, that is not the case.
This is a late reply because I missed this until now, but if you accept the typical parameters of a statistical thought experiment, you should assume that the permutations are equally likely. The real world nastiness of biology and society fouls that up, but thought experiments like this are never intended to be about not picky real world details, boy/girl is always assumed to be a coin flip. (Not to say that real world results are not interesting as well)

And there are a half dozen arguments in this thread that claim to disprove this result even if they accept the coinflip hypothesis - it's really those that I take issue with.

The real answer is men. By a small amount.

First of all as many sources will afirm, for example http://www.pewresearch.org/fact-tank/2013/09/24/the-odds-tha..., the ratio of boys to girls at birth is not 50-50 and is not the same across ethnic groups, cultures, etc. With some surprising interaction effects.

As soon as you have a mix of families with different sex ratios, the odds of siblings being brothers is now positively correlated (even if ever so little) with your own gender. And the result of that is that the average man has more brothers than the average woman does.

However the theoretical effect is very small, and you would need a large random sample to reliably detect its existence.

If every family only has one child, nobody has any brothers; the results are equal at 0 average brothers.

If we take some distribution over size n of the families, say a distribution where family size is either 1 or 2, then the 1-size families don't contribute (they add a zero to the fraction, dragging the probability down in a systematic way equal for both sexes), and the 2-size families have four equally probable outcomes.

those four outcomes (bb bg gb gg) yield:

two females with no brothers. two females with one brother. two males with no brothers. two males with one brother.

i.e. the average numbers of brothers are equal (1/2 for males, and the same for females.)

The next layer, where n = 3, there are (ggg ggb gbg bgg gbb bgb bbg bbb) 8 combinations, yielding:

three females with no brothers. six females with one brother. three females with two brothers. three males with no brothers. six males with one brother. three males with two brothers.

Average number of brothers for females is (30 + 61 + 32) / 12 = 1. Average number of brothers for males is (32 + 61 + 30) / 12 = 1.

for n = 4, (gggg gggb ggbg gbgg bggg ggbb gbgb gbbg bggb bgbg bbgg gbbb bgbb bbgb bbbg bbbb), there are 16 combinations (yes, these map to binary integers quite nicely):

four females with no brothers. twelve females with one brother. twelve females with two brothers. four females with three brothers. four males with no brothers. twelve males with one brother. twelve males with two brothers. four males with three brothers.

Again, this comes out at an even probability - 48 / 32 = 2 brothers, on average.

By induction, we can say that for any n, the probabilities are equal (if the probability of male and female children is equal).

Thus, for any distribution of family sizes, the probabilities are equal.

---

Real world criticisms:

* males are more likely (~51% of births naturally, higher thanks to sex-selective terminations in China and India.) Thus, outcomes with more males are more likely, which skews towards male-heavy families. While this means both males and females have more brothers, there are more males to count with higher numbers of brothers, so their average goes higher.

* males die more frequently at younger ages, so older people will have fewer brothers than younger people.

> * males are more likely (~51% of births naturally, higher thanks to sex-selective terminations in China and India.)

In China, there may be more sons, but they're not likely to have brothers.

> * males die more frequently at younger ages, so older people will have fewer brothers than younger people.

Most people still consider dead siblings to be siblings.

My understanding is women have a higher death rate than men when young due to when there are limited funds they get worst heath care in families.

So brother and sister goes to boy. Brother brother stays brother brother.

Not sure on percents though. It might not override the issue of correlated data and selective breeding.

(Edit - actually now I try think about it this is wrong since now there's also one less women in the world, the mens average also changes)