At time $0$, an urn contains $1$ black ball and $1$ white ball. At each time $1,2,3,...,$ a ball is chosen at random from the urn and is replaced together with a new ball of the same colour. Just after time $n$, there are therefore $n+2$ balls in the urn, of which $B_n+1$ are black, where $B_n$ is the number of black balls chosen by time $n$. Let $M_n = \frac{B_n + 1}{(n + 2)}$, the proportion of black balls in the urn just after time $n$. Prove that (relative to a natural filtration which you should specify) $M$ is a martingale.
There are several ways of solving the problem. One proof starts off by letting $\mathcal{F}_n=\sigma(B_1,...,B_n)$ and then stating $$E[M_n|\mathcal{F}_{n-1}]=P(B_n=B_{n-1})\frac{B_{n-1}+1}{n+2}+P(B_n=B_{n-1}+1)\frac{B_{n-1}+2}{n+2}$$ Intuitively speaking, I agree completely with the equation. It reminds of the basic definition of conditional expectation for discrete rv $X$ given $Y=y$: $$E(X|Y=y)=\sum_xx\cdot P(x|y)$$ How can one prove the equation rigorously? There are similar problems like De Moivre's martingale (https://en.wikipedia.org/wiki/Martingale_(probability_theory)) which make use of the same property of conditional expectation to state: $$E(Y_{n+1}|X_1,...,X_n)=p\left(\frac{q}{p}\right)^{X_n+1}q\left(\frac{q}{p}\right)^{X_n-1}$$ from which it is easy to then show that $(Y_n)_{n\in\mathbb{N}}$ is a martingale. What is the general formula that I am missing which applies to both of these problems?