TITLE: Stochastic Differential Equation solution for Geometric Brownian Motion
QUESTION [10 upvotes]: I am having difficulty in understanding the solution for a GBM given the SDE:
$$dY(t)=\mu \ Y(t) \ dt + \sigma \ Y(t) \ dZ(t)$$ or $$\frac{dY(t)}{Y(t)}=\mu \ dt + \sigma \ dZ(t)$$
The solution for the above SDE is:
$$\int_0^t\frac{dY(t)}{Y(t)} = \int_0^t\mu \ ds + \int_0^t\sigma \ dZ(s)$$
$$Y(t) = Y(0)e^{(\mu-\frac{\sigma^2}{2})t+\sigma\ Z(t)}$$
What I can't understand is, how does this,
$$\int_0^t\frac{dY(t)}{Y(t)}=\ lnY(t) - \ lnY(0)$$
become this,
$$Y(t) = Y(0)e^{(\mu-\frac{\sigma^2}{2})t+\sigma \ Z(t)}$$
This part, $-\frac{\sigma^2}{2}$ is extra in the exponent. How?
Thank you in advance!

REPLY [4 votes]: I believe the answer by @Yujie Zha can be simplified substantially. Thanks to @Dr. Lutz Lehmann for providing a link to this, my solution is the same as the solution on page 15, but with more intermediate steps. I decided to write this as this helped me to figure out why the solution to the Geometric Brownian Motion SDE is the way it is. If I am wrong, please correct me.
Solution
Let $$dY(t) = \mu Y(t)dt + \sigma Y(t)dZ(t) ~~~~\text{(1)}$$ be our geometric brownian motion (GBM). Now rewrite the above equation as $$dY(t) = a(Y(t), t)dt + b(Y(t), t)dZ(t)~~~~\text{(2)}$$ where $a = \mu Y(t)$, $b = \sigma Y(t)$. Both are functions of $Y(t)$ and $t$ (albeit simple ones). Now also let $f = \ln(Y(t))$. We can now apply Ito's lemma to equation $(2)$ under the function $f = \ln(Y(t))$. This leads to $$ df = d(\ln(Y(t)) = \left(\frac{\partial f}{\partial t} + \frac{\partial f}{\partial Y}a + \frac{1}{2}\frac{\partial^2f}{\partial Y^2}b^2\right)dt + b\frac{\partial f}{\partial Y}dZ(t)~~~~\text{(3)}$$ Now we substitute all the derivatives in $(3)$ and the functions $a$ and $b$. Note that $\frac{\partial f}{\partial t} = \frac{\partial \ln(Y(t))}{\partial t} = 0 $ (partial derivative w.r.t. $t$ of a function of $Y$ is $0$), $\frac{\partial f}{\partial Y} = \frac{\partial \ln(Y)}{\partial Y} = \frac{1}{Y}$, $\frac{\partial^2 f}{\partial Y^2} = -\frac{1}{Y^2}$ (standard calculus). We finally have that $$ (3) = \left( 0 + \frac{1}{Y}Y\mu + \frac{1}{2}\left(-\frac{1}{Y^2}\right)\sigma^2 Y^2\right)dt + \sigma Y \frac{1}{Y}dZ(t) = \left(\mu - \frac{\sigma^2}{2}\right)dt + \sigma dZ(t)$$ i.e.
$$d(\ln(Y(t)) = \left(\mu - \frac{\sigma^2}{2}\right)dt + \sigma dZ(t)$$ Integrating this from $0$ to $t$ gives $$\ln(Y(t)) - \ln(Y(0)) = \left(\mu - \frac{\sigma^2}{2}\right)t + \sigma (Z(t) - Z(0))$$ The integral $\int_0^{t}dZ(t)$ is, by the definition of the Ito integral, equal to $Z(t) - Z(0)$ as we are integrating the simple constant process $1$ w.r.t. Brownian motion.
If we rearrange and note that $Z(t) \sim N(0, t), Z(0) \sim N(0,0) = 0$ and are independent, we finnally get $$Y(t) = Y(0)\exp\left((\mu - \frac{\sigma^2}{2})t + \sigma Z(t)\right)$$