Deriving master equation for discrete process

Consider a group of $N$ professors, $Y$ of whom are wearing white socks and $X = N − Y$ others who are wearing black socks.
On each time step, one professor is chosen at random and he has to put a new pair of socks on, irrespectively of the color of the socks he is currently wearing. The probability of the professor choosing a white pair of socks is $p$ and the probability of him choosing a black pair of socks is $1 − p$, independently of the pair of socks he was previously wearing.

a) How can I derive a master equation for the model of how the probability $\pi(i,t)$ that $i$ professors are wearing white socks at time $t$ changes throught time, that is, how $\pi(i,t+1)$ varies with $\pi(i,t)$, $\pi(i-1,t)$ and $\pi(i+1,t)$?

b) How can I solve the master equation to show that, for $t \rightarrow \infty$,
$$ \pi(i) = \left( \begin{array}{c}
N\\
i\end{array} \right) p^i (1-p)^{N-i} \;?$$

MY ATTEMPT

a)
$$\begin{align}
\pi(i,t+1) = & \pi(i-1,t) P(X\rightarrow Y) + \pi(i+1,t) P(Y\rightarrow X) + \\ & \pi(i,t) P(Y\rightarrow Y) + \pi(i,t) P(X\rightarrow X)\\
= & \pi(i-1,t) p \frac{N-(i-1)}{N} + \pi(i+1,t) (1-p) \frac{i+1}{N} + \\
& \pi(i,t) p \frac{i}{N} + \pi(i,t) (1-p) \frac{N-i}{N}
\end{align}$$

Do you think this is correct?

b)

I’ve tried to assume $\pi(i)$ is as told, and then substitute it on the RHS of the master equation I derived, but I cannot reach an equality.

Thanks in advance for all the help you can provide.

Solutions Collecting From Web of "Deriving master equation for discrete process"

This seems to be a variant of the ‘Ehrenfest urn model’.

The equation you have derived provides the $(N+1) \times (N+1)$ transition matrix $P$ of a Markov Chain.

Your binomial distribution is the proposed steady-state distribution $(N+1)$-vector $\sigma$ of the chain.

If $\sigma P = \sigma$, then $\sigma$ is indeed the steady-state (stationary) distribution of the chain.

I believe this is what you must mean by ‘master equation’.