Here is the problem that I'm trying to solve:
Given a bag filled with red and white marbles, the probability of choosing a red and a white marble without replacement is 2/5. What is the minimum possible number of marbles in the bag?
I tried solving this problem with events probability, so I wrote the following equations:
Let R be the number of red marbles and W be the number of white marbles
We have (R/(R+W)) * (W/(R+W-1)) + (W/(R+W)) * (R/(R+W-1)) = 2/5, or
2 * ((RW)/((R+W) * (R+W-1))) = 2/5, so
(RW)/((R+W) * (R+W-1)) = 1/5.
From here, I did some lucky guessing and found that when R = 4 and W = 1, the equation holds, given me an answer of 5. However, I don't think that this was the intended solution, so can somebody please tell me of another solution that doesn't require guessing and checking?
You can rewrite $$\frac{rw}{(r+w)(r+w-1)}=\frac15$$ as
$$5rw=(r+w)(r+w-1)\,;$$
if you let $n=r+w$, you can rewrite this as
$$5r(n-r)=n(n-1)\,.$$
Clearly $5$ must be a divisor of $n$ or $n-1$, so the smallest possible value of $n$ is $n=5$. Then $r(5-r)=4$, which can be solved by inspection or by solving the quadratic, which factors readily as $(r-4)(r-1)=0$.