Solution of SDE $dX_t = \mu(t)X_tdt + \sigma X_t dW_t$ I didn't study stochastic process in a systematic way, but I need to use it in financial analysis. Here's my question.
I know the solution of the SDE $dX_t = \mu X_tdt + \sigma X_t dW_t$, given that $\mu$ and $\sigma$ are constants, and now I was asked to solve the following SDE

$dX_t = \mu(t)X_tdt + \sigma X_t dW_t$, given that $\mu(t)$ is a growth function

My attempt
So I simply follow the procedure as that when $\mu$ is constant. Let $y=f(x)= \ln X$ (actually I don't know why $\ln X$ is chosen, could anyone explain it to me?) and apply Ito's lemma. We have $$dy=(\mu (t) - \frac{\sigma ^2}{2})dt + \sigma dW_t$$ Differentiating both sides, the solution is given by $$y_t =y_0 + \int_0^t \mu (s)s ds - \frac{\sigma ^2}{2}t + \sigma W_t $$ Since $X=e^y$, we have $$X_t = e^{y_0 + \int_0^t \mu (s)s ds - \frac{\sigma ^2}{2}t + \sigma W_t} =X_0 e^{ \int_0^t \mu (s)s ds - \frac{\sigma ^2}{2}t + \sigma W_t}$$
Is my try correct? 
 A: The reason $\ln(x)$ is chosen is this: 
(Note: where I say $B_{t}$ I mean Brownian motion, which you denoted in your question as $W_{t}$)
The SDE you provided is one of the few we can explicitly solve.  I'll talk about Geometric Brownian Motion (GBM) $dX_{t} = \mu X_{t} \,dt + \sigma X_{t} \,dB_{t}$, but as you mentioned in your question, your case is the same when $\mu$ becomes a function of $t$.
You can "multiply" the stochastic differential equation (SDE) in its differential form by $\frac{1}{X_{t}}$ to get $$\frac{1}{X_{t}}dX_{t} = \frac{1}{X_{t}}\mu X_{t} \,dt + \frac{1}{X_{t}}\sigma X_{t} \,dB_{t} $$
and this simplifies to $$ \frac{1}{X_{t}}dX_{t} = \mu  \,dt + \sigma \,dB_{t}.$$
Notice that the right hand side no longer depends on $X_{t}$.  Now recall Ito's formula for a $C^{2,1}$ function $f(t,x)$ ($C^{2,1}$ means $f$ is twice differentiable in $x$ and once differentiable in $t$).  Ito's formula tells us if $X_{t}$ satisfies the previous SDE, then $f(t,X_{t})$ will satisfy:
$$d(f(t,X_{t})) = \frac{\partial f}{\partial t}(t,X_{t}) \,dt + \frac{\partial f}{\partial x}(t,X{t}) \,dX_{t} + \frac{1}{2} \frac{\partial^{2} f}{\partial x^{2}}(t,X_{t}) \,d[X]_{t}$$
where $[X]_{t}$ is the quadratic variation process of $X_{t}$.  Notice that in the SDE given to us by Ito's formula, one of the terms on the right hand size is $\frac{\partial f}{\partial x}(t,X{t}) \,dX_{t}$.  This almost looks like our $\frac{1}{X_{t}} \,dX_{t}$, which was the left hand side of our original SDE.  If we can choose $f(t,X_{t})$ wisely such that these are equal (i.e., such that $\frac{\partial f}{\partial x}(t,X{t})= \frac{1}{X_{t}}$, then we can solve this special SDE.  
Hopefully you see that we should have $f(t,x) = \ln(x)$ for the above equality to hold.  Okay, so since $f$ doesn't depend on $t$, let's call it $f(x)$ to save space.  Substituting this $f$ into Ito's formula above gives:
$$d(\ln(X_{t})) = 0 \,dt + \frac{1}{X_{t}} \,dX_{t} - \frac{1}{2} \frac{1}{X_{t}^2} \,d[X]_{t}$$
Hmm... on the right hand side there is conveniently a $\frac{1}{X_{t}} \,dX_{t}$ (which was the whole point! That's why we choose $f$ as we did) and we have an SDE for this already.  We have that $\frac{1}{X_{t}}dX_{t} = \mu  \,dt + \sigma \,dB_{t}$.
Okay, so solving for $\frac{1}{X_{t}}\,dX_{t}$ in the Ito's formula SDE gives
$$\frac{1}{X_{t}} \,dX_{t}  =d(\ln(X_{t}))  + \frac{1}{2} \frac{1}{X_{t}^2} \,d[X]_{t} $$
and this allows us to set the right hand side of the above equal to $\mu  \,dt + \sigma \,dB_{t}$.  So we have $$d(\ln(X_{t}))  + \frac{1}{2} \frac{1}{X_{t}^2} \,d[X]_{t} = \mu  \,dt + \sigma \,dB_{t}. $$
What is $d[X]_{t}$?  If you do the computation, you get $\sigma^{2} X_{t}^{2} \,dt$, so that our equation becomes $$d(\ln(X_{t}))  + \frac{1}{2} \sigma^{2} \,dt = \mu  \,dt + \sigma \,dB_{t}. $$
This simplifies to $$\ln(X_{t}) = \ln(X_{0}) + \int \limits_{0}^{t}(\mu - \frac{1}{2} \sigma^{2}) \,dt + \int \limits_{0}^{t}\sigma \,dB_{t} $$
so that $X_{t} = X_{0}e^{\int \limits_{0}^{t}(\mu - \frac{1}{2} \sigma^{2}) \,dt + \int \limits_{0}^{t}\sigma \,dB_{t}}$.
