<?xml version="1.0" encoding="UTF-8" ?>
  <resource>
  <id>7061</id>
  <path>/www/nrich/html/content/id/7061/</path>
  <resourceTypeID>1</resourceTypeID>
  <last_published>2011-05-11T13:30:29</last_published>
  <indexXML>&lt;mdoxml version=&quot;1.0&quot;&gt;
  &lt;br /&gt;
  &lt;ul id=&quot;buttonBar&quot;&gt;
    &lt;li&gt;
      &lt;a href=&quot;http://nrich.maths.org/631&amp;amp;part=&quot;&gt;Warm-up
problem&lt;/a&gt;
    &lt;/li&gt;
    &lt;li&gt;
      &lt;a href=&quot;http://nrich.maths.org/358&amp;amp;part=&quot;&gt;Try this next&lt;/a&gt;
    &lt;/li&gt;
    &lt;li&gt;
      &lt;a href=&quot;https://nrich.maths.org/discus/messages/27/27.html&quot;&gt;Ask
NRICH&lt;/a&gt;
    &lt;/li&gt;
    &lt;li&gt;
      &lt;a href=&quot;http://nrich.maths.org/7326&amp;amp;part=&quot;&gt;Read all about
it&lt;/a&gt;
    &lt;/li&gt;
    &lt;li&gt;
      &lt;a href=&quot;http://nrich.maths.org/7290&amp;amp;part=solution&quot;&gt;Last week's
solution&lt;/a&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  &lt;div&gt;
    &lt;br /&gt;
    &lt;br /&gt;
A magic bag contains some black and white balls, all of the same
size and shape.&lt;br /&gt;
    &lt;br /&gt;
 I put my hands in the bag and simultaneously and randomly pull out
two balls. They are both the same colour and the magic bag tells me
that the chance of this occurring was exactly $0.5$.&lt;br /&gt;
    &lt;br /&gt;
 I wonder to myself how this condition constrains the numbers of
black and white balls.&lt;br /&gt;
    &lt;br /&gt;
At the same time, the bag, who can read minds, says &quot;I'll give you
a hint: it's got something nice to do with triangle
numbers.&quot;&amp;#160;&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
  &lt;/div&gt;
  &lt;div class=&quot;framework&quot;&gt;
    &lt;span style=&quot;font-style: italic;&quot;&gt;Did you
know ... ?&lt;/span&gt;
    &lt;br /&gt;
    &lt;br /&gt;
Probability theory has many overlaps with the study of
combinatorics. Is it fascinating how beautiful and tricky the
consequences of counting become!&lt;/div&gt;
  &lt;br /&gt;
&lt;/mdoxml&gt;
</indexXML>
  <solutionXML>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;mdoxml version=&quot;1.0&quot;&gt;
&lt;br&gt;&lt;/br&gt;
Although this problem might sound insoluble with the information given, the magic bag assures us that there is a nice answer, as does Mr Cox from North Berwick High School who solved this problem very nicely (&lt;a href=&quot;/content/id/7061/magic%20bag%20Alan%20Cox.pdf&quot;&gt;see his solution here&lt;/a&gt;) so let us proceed!&lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
Suppose that there are $b$ black balls and $w$ white balls in the bag, and that there are at least two of each (we can think about the other cases at the end).&lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
Then&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
\begin{eqnarray}&lt;br&gt;&lt;/br&gt;
P(bb) &amp;amp;=&amp;amp; \frac{b}{b+w}\cdot\frac{b-1}{b+w-1}\cr&lt;br&gt;&lt;/br&gt;
P(wb) &amp;amp;=&amp;amp; \frac{b}{b+w}\cdot\frac{w}{b+w-1}\cr&lt;br&gt;&lt;/br&gt;
P(bw) &amp;amp;=&amp;amp; \frac{w}{b+w}\cdot\frac{b}{b+w-1}\cr&lt;br&gt;&lt;/br&gt;
P(ww) &amp;amp;=&amp;amp; \frac{w}{b+w}\cdot\frac{w-1}{b+w-1}&lt;br&gt;&lt;/br&gt;
\end{eqnarray}&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
Although these look complicated, the denominators in each case are the same.&lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
Since the probabilities are mutually exclusive we know that &lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
P(bb)+P(ww) = 0.5&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
Thus, &lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
 2b(b-1)+2w(w-1) = (b+w)(b+w-1)&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
Expanding and rearranging gives us&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
b^2-b+w^2-w-2wb=0&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
So, where are we now? We've applied the probability and are left with an expression involving $w$ and $b$. This can be factorised as&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
(b-w)^2=b+w&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
Some thought should convince you that this expression is satisfied if $b$ and $w$ are consecutive triangle numbers. But we need to ask: are there any other solutions? We need to ask this because for any choice of $w$ there will be up to $2$ solutions for $b$ upon solving the equation. The quadratic formula tells us that for any given $w$&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
b=\frac{1+2w\pm \sqrt{1+8w}}{2}&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
Now, we need to impose the condition that $b$ and $w$ are natural numbers. This would require that $1+8w$ is a square number, say $N^2$. Then &lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
w =\frac{N^2-1}{8}=\frac{(N+1)(N-1)}{8}&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
For $w$ to be a natural number, $N$ must be an odd number, which means that $(N+1)$ and $(N-1)$ are consecutive even numbers, which means that $\frac{N+1}{2}$ and $\frac{N-1}{2}$ are consecutive natural numbers. Thus, $w$ is half the product of two natural number which means that $w$, by definition must be triangular. Thus there is a solution in this case if and only if $w$ and $b$ are
consecutive triangle numbers bigger than $1$.&lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
Finally, we consider the special cases where there are less then two of each ball.&lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
Clearly, the balls cannot all be the same colour, as then the chance of drawing two balls of the same colour would be $1$. Clearly, there cannot be exactly one ball of each colour, as then the chance of drawing two balls of the same colour would be $0$. If there were exactly one black ball and $w&amp;gt; 1$ white balls then the chance of drawing two balls of the same colour would be &lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
\frac{w}{w+1}\cdot\frac{w-1}{w} = 0.5&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
This has exactly the two solutions $w=0, 3$. Since $3$ is also triangular, our rule still holds.&lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
 Putting this all together proves that magic bag can, and only can, contain consecutive triangle numbers of white and black balls.&lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;

&lt;/mdoxml&gt;</solutionXML>
  <noteXML/>
  <clueXML/>
  <canonXML>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;mdoxml version=&quot;1.0&quot;&gt;&lt;br&gt;&lt;/br&gt;
Although this problem might sound insoluble with the information
given, the magic bag assures us that there is a nice answer, so let
us proceed!&lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
Suppose that there are $b$ black balls and $w$ white balls in the
bag, and that there are at least two of each (we can think about
the other cases at the end).&lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
Then&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
\begin{eqnarray}&lt;br&gt;&lt;/br&gt;
P(bb) &amp;amp;=&amp;amp; \frac{b}{b+w}\cdot\frac{b-1}{b+w-1}\cr&lt;br&gt;&lt;/br&gt;
P(wb) &amp;amp;=&amp;amp; \frac{b}{b+w}\cdot\frac{w}{b+w-1}\cr&lt;br&gt;&lt;/br&gt;
P(bw) &amp;amp;=&amp;amp; \frac{w}{b+w}\cdot\frac{b}{b+w-1}\cr&lt;br&gt;&lt;/br&gt;
P(ww) &amp;amp;=&amp;amp; \frac{w}{b+w}\cdot\frac{w-1}{b+w-1}&lt;br&gt;&lt;/br&gt;
\end{eqnarray}&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
Although these look complicated, the denominators in each case are
the same.&lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
Since the probabilities are mutually exclusive we know
that &lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
P(bb)+P(ww) = 0.5&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
Thus, &lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
 2b(b-1)+2w(w-1) = (b+w)(b+w-1)&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
Expanding and rearranging gives us&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
b^2-b+w^2-w-2wb=0&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
So, where are we now? We've applied the probability and are left
with an expression involving $w$ and $b$. This can be factorised
as&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
(b-w)^2=b+w&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
Some thought should convince you that this expression is satisfied
if $b$ and $w$ are consecutive triangle numbers. But we need to
ask: are there any other solutions? We need to ask this because for
any choice of $w$ there will be up to $2$ solutions for $b$ upon
solving the equation. The quadratic formula tells us that for any
given $w$&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
b=\frac{1+2w\pm \sqrt{1+8w}}{2}&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
Now, we need to impose the condition that $b$ and $w$ are natural
numbers. This would require that $1+8w$ is a square number, say
$N^2$. Then &lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
w =\frac{N^2-1}{8}=\frac{(N+1)(N-1)}{8}&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
For $w$ to be a natural number, $N$ must be an odd number, which
means that $(N+1)$ and $(N-1)$ are consecutive even numbers, which
means that $\frac{N+1}{2}$ and $\frac{N-1}{2}$ are consecutive
natural numbers. Thus, $w$ is half the product of two natural
number which means that $w$, by definition must be triangular. Thus
there is a solution in this case if and only if $w$ and $b$ are
consecutive triangle numbers bigger than $1$.&lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
Finally, we consider the special cases where there are less then
two of each ball.&lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
Clearly, the balls cannot all be the same colour, as then the
chance of drawing two balls of the same colour would be $1$.
Clearly, there cannot be exactly one ball of each colour, as then
the chance of drawing two balls of the same colour would be $0$. If
there were exactly one black ball and $w&amp;gt; 1$ white balls then the
chance of drawing two balls of the same colour would be &lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
\frac{w}{w+1}\cdot\frac{w-1}{w} = 0.5&lt;br&gt;&lt;/br&gt;
$$&lt;br&gt;&lt;/br&gt;
This has exactly the two solutions $w=0, 3$. Since $3$ is also
triangular, our rule still holds.&lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
 Putting this all together proves that magic bag can, and only
can, contain consecutive triangle numbers of white and black
balls.&lt;br&gt;&lt;/br&gt;
 &lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/mdoxml&gt;</canonXML>
  <end_user_role>2</end_user_role>
  <difficulty>5</difficulty>
  <keystage1>0</keystage1>
  <keystage2>0</keystage2>
  <keystage3>0</keystage3>
  <keystage4>0</keystage4>
  <keystage4plus>1</keystage4plus>
  <title>Weekly Challenge 37: Magic Bag</title>
  <description>A weekly challenge concerning combinatorical probability.</description>
  <spec_group>Collections
    <specifier>Weekly Challenge</specifier>
  </spec_group>
  <spec_group>Probability
    <specifier>Theoretical probability</specifier>
  </spec_group>
  <spec_group>Stage 5 Statistics Mapping Document
    <specifier>SM - Advanced probability</specifier>
  </spec_group>
</resource>