Solution (source code)

= Solution

Set
$$
\lambda=\frac{\mu-r}{\sigma},
\qquad
\frac{dQ}{dP}
=\exp\left(-\lambda W_T-\frac12\lambda^2T\right).
$$
By the <Girsanov theorem>, $W_t^Q=W_t+\lambda t$ is Brownian motion under $Q$. Consequently
$$
dS_t=rS_t\,dt+\sigma S_t\,dW_t^Q,
$$
so discounted stock price is a martingale and $Q$ is the <Risk-neutral measure for the Black-Scholes model>.