# Risk-Neutral probability deduction [closed]

Could anyone show me how to get the second row equation from the first row equation please? For each letter, $$p$$ is the risk-neutral probability in the risk-neutral world, $$u$$ is the up factor for the stock, and $$d$$ is the down factor for the stock, S0 is the beginning stock price. The equation is based on a one-step binomial tree model.

The textbook referred to is Options, futures, and other derivatives by John Hull 10th. Thank you guys.

\begin{align} \mathrm{E}(S_T) &= pS_o u + (1 - p)S_0 d \\ &= pS_o u - pS_0 d + S_0 d \\ &= pS_o (u - d) + S_0 d \end{align}