The question comes from an interview problem that reads as follows:
There is a bag with $w$ white balls and $r$ red balls. You iteratively extract one ball per time from the bag until only one is left. What is the probability that the last ball is red?
How to solve the problem above?
My approach is to write down a recurrence relation: $$p(w,r) := \mathbb{P}(\text{last ball is red }| \;w \text{ white balls and } r \text{ red balls} ),$$ then $$p(r,w) = \frac{r}{r+w}\,p(r-1, w) + \frac{w}{r+w}\,p(r, w-1)$$ with initial conditions $$p(r,0) = 1, \qquad p(0,w) = 0.$$
Looking at a few examples one comes up with and verifies that $$p(r,1) = \frac{r}{r+1}.$$
To solve the general case I considered the generating function $$G(x,y) := \sum_r \sum_w p(r,w) x^r y^w,$$ but, since the recurrence relation is non-linear, it is not obvious to me how to find a functional equation for it.
On a side note: In the link it is claimed that the solution is $p(r,w) = \frac{r}{r+w}$; but this does not satisfy the recurrence relation and seems to be wrong.
Imagine the balls are distinct (numbered) and we order them according to the extraction order.
Then the number of total arrangements are $(w+r)!$ and the successfull ones are $ r (r+w-1)!$
Because all arrangements are equiprobable the probability of success is then
$$ \frac{r (r+w-1)!}{(w+r)!}=\frac{r}{w+r}$$
More simply: by symmetry, the probability of the last ball being red is the same of the first ball being red. Which is $\frac{r}{w+r}$
Your recursion is ok, and the solution above satisfies it.