Stochastic Differential Equation solution for Geometric Brownian Motion 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!
 A: 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)$$
A: Your integration step is wrong. $Z$ here refers to Brownian motion, and thus you need to apply Ito Integration.
One way I like to see the extra drift is needed, is that we take derivative of the integration result, and see if they match the SDE or not, using Ito Lemma.
So if $Y_t =f(t, Z_t)$, with $f(t,z)=f(0, Z_0)e^{(\mu-\frac{\sigma^2}{2})t+\sigma z}$, where $Z_t$ is an adapted stochastic process, we have:
$$dY_t=df(t, Z_t)=\frac{\partial f(t, Z_t)}{\partial t} dt+ \frac{\partial f(t, Z_t)}{\partial z}dZ_t + \frac{1}{2} \cdot\frac{\partial^2 f(t, Z_t)}{\partial z^2}(dZ_t)^2$$
And for $Z_t$ being Brownian motion, we also have $(dZ_t)^2=dt$
Now let's plug in for the question here:
$$Y_t= Y_t(0)e^{(\mu-\frac{\sigma^2}{2})t+\sigma Z_t}$$
$$dY_t=(\mu-\frac{\sigma^2}{2})Y_tdt + \sigma Y_tdZ_t + \frac{1}{2}\sigma\sigma Y_t(dZ_t)^2$$
$$=(\mu-\frac{\sigma^2}{2})Y_tdt + \sigma Y_tdZ_t + \frac{1}{2}\sigma^2 Y_tdt$$
Thus
$$dY_t=\mu Y_tdt + \sigma Y_tdZ_t$$
Which means that the $Y$ we get is the solution for the SDE.
EDIT
So OP wants to solve instead of see why that extra drift exists. Basically integration and derivative are the same thing, just notations:
So the following integration is Ito, $Y$ is not smooth enough for you to apply the calculus rule you are familiar with.
$$\int \frac{dY}{Y} \color{red}\ne \ln(Y)$$
Notice
$$d(\ln Y)=\frac{dY}{Y} -\frac{1}{2}\frac{1}{Y^2}(dY )^2$$
$$(dY)^2=(\mu Y_tdt + \sigma Y_tdZ_t)^2=\sigma^2Y^2 dt$$
We also know $\frac{dY}{Y}$ from our original SDE.
Plug them in and we get:
$$d(\ln Y)=\mu dt + \sigma dZ-\frac{\sigma^2}{2} dt$$
Now the right-hand-side do not have $Y$, you'll be able to solve it, i.e.
$$\ln Y_t - \ln Y_0 = \int_0^t d(\ln Y) = \int_0^t (\mu -\frac{\sigma^2}{2})dt + \int_0^t \sigma dZ_t=(\mu -\frac{\sigma^2}{2})t + \sigma Z_t$$
