# Given the Probability, Find the Sample Space

Here is a simple but rather unusual problem:

### Problem

### Solution 1

From a group of $b$ boys and $g$ girls a teacher can form $\displaystyle \frac{(b + g)(b + g - 1)}{2}$ pairs of which $bg$ pairs are of different sexes. To insure the $50%$ chance of the same sex selection, the former number needs to be twice the latter:

$\displaystyle \frac{(b + g)(b + g - 1)}{2} = 2bg$

which reduces to

$(b - g)^2 = b + g.$

Letting $b - g = n$ leads to a system

$\begin{align} b - g &= n\\ b + g &= n^2 \end{align}$

from which $\displaystyle b = \frac{n(n+1)}{2}$, $\displaystyle g = \frac{n(n-1)}{2}.$ Cases where $n = 0$ (no kids at all), or $n = \pm 1$ (one sex is missing) can be disregarded. Other than those, $n$ could be any integer. When $n$ is negative, $g \gt b;$ when it is positive, $b \gt g.$

In any event, $b$ and $g$ need to be two consecutive triangular numbers.

### Solution 2

Suppose there are $b$ boys and $g$ girls. Number of ways of choosing two boys is $C(b,2)$, number of ways of choosing two girls is $C(g,2)$, and number of ways of choosing a boy and a girl is $bg$. Thus the condition of the problem implies

$\displaystyle \begin{align} &C(b,2)+C(g,2)=bg \\ &b(b-1)+g(g-1)=2bg \\ &b=g+\frac{1}{2}\pm\frac{1}{2}\sqrt{8g+1} \end{align}$

Note, $b=g$ results in $b=g=0$. Thus, $b\neq g$. Noting that the problem is symmtric in $b$ and $g$, let us find solutions with $b\gt g$ and get the other set of solutions by swapping $b$ and $g$ from the first set. For $b\ gt g$, we have to drop the negative square root.

Noting that any odd square is of the form $(8k+1)$, let $8g+1=(2n+1)^2$ for $n\gt 0$. Thus, the frst set of solutions is

$\displaystyle \begin{align} g&=\frac{(2n+1)^2-1}{8}=\frac{n(n+1)}{2} \\ b&=\frac{(2n+1)^2-1}{8}+(n+1)=\frac{(n+1)(n+2)}{2}, \end{align}$

and the alternate set of solutions is

$\displaystyle \begin{align} b&=\frac{(n+1)(n+2)}{2} \\ g&=\frac{n(n+1)}{2}, \end{align}$

where $n$ is any positive integer.

### Solution 3

The binomial distribution with $n$ trials and success probability $p$:

$\mathbb{P}(X=x)=f(x)=\begin{cases} (1-p)^{n-x} p^x \binom{n}{x} & 0\leq x\leq n \\ 0 & \text{Otherwise} \end{cases}$

Here we have $f(2)=\frac{1}{2}.$ Let $n= n_B +n_G$ be the total number of pupils, with $n_B$ initial the number of boys, etc. Let $\displaystyle p=\frac{n_B}{n}=\frac{n_B}{n_A+n_B}$. We have the tuples in a draw of 2:

$\displaystyle \left( \begin{array}{ccc c} B & B & w.p & \frac{n_B}{n}\frac{n_B-1}{n-1}\\ B & G & w.p & \frac{n_B}{n}\frac{n_G}{n-1}\\ G & B & w.p & \frac{n_G}{n}\frac{n_B}{n-1}\\ G & G & w.p & \frac{n_G}{n}\frac{n_G-1}{n-1}\\ \end{array} \right)$

We have to solve for

$\displaystyle \frac{\left(n_B-1\right) n_B}{\left(n_B+n_G-1\right) \left(n_B+n_G\right)}+\frac{\left(n_G-1\right) n_G}{\left(n_B+n_G-1\right) \left(n_B+n_G\right)}=\frac{1}{2}$

Reducing:

$\displaystyle \frac{4 n_B n_G}{\left(n_B+n_G-1\right) \left(n_B+n_G\right)}=1$

which leads to two solutions (depending if $n_G >n_B$ or the reverse:

$n_G=\frac{1}{2} \left(\pm\sqrt{8 n_B+1}+2 n_B+1\right).$

It follows that $\displaystyle n_G,n_B=\frac{1}{2}(n\pm\sqrt{n}).$ To make all the quantities integer we need to assume that $n$ is a square: $n=k^2,$ simplifying the above to $\displaystyle n_G,n_B=\frac{1}{2}k(k \pm 1).$

### Extra

Rob Eastaway posted a modification on twitter:

Group of children, $3$ of them boys. If I pick two children at random, there's a $50%$ chance both are boys. How many girls?

This is better be generalized. Let $T_{n} = \displaystyle \frac{n(n + 1)}{2}$ be the $n^{th}$ triangular number. Then we can pose the follwing problem:

Group of children, $T_{n}$ of them boys. If I pick two children at random, there's a $50%$ chance both are boys. How many girls?

Repeating the derivation above will leads to the answer $\displaystyle g = \frac{n(n - 1)}{2} = T_{n-1}.$

To answer Rob's question, $3 = 2\cdot \displaystyle \frac{3}{2} = T_{2},$ therefore, in his case, the number of girls is $T_{1} = \displaystyle \frac{1\cdot 2}{2} = 1.$

### Acknowledgment

The problem and Solution 1 came from Simon Norton's chapter, __From Sex to Quadratic Forms__ of the book An Invitation to Mathematics by D. Schleicher, M. Lackmann (eds). Solution 2 is by Amit Itagi; Solution 3 is by N. N. Taleb.

The problem (under the guise of drawing socks from a drawer) is also included (as Problem 1) in the Fifty Challenging Problems in Probability with Solutions by F. Mosteller.

|Contact| |Front page| |Contents| |Probability|

Copyright © 1996-2018 Alexander Bogomolny

64859491 |