Solving an SDE with Ito's Lemma I want to solve the initial value problem
$$ dX_t = \left(\frac{b^2}{4} - X_t\right)dt + b\sqrt{X_t}dw$$
I have the initial condition $X_0 = x > 0$. Note this process stops when $X_t = 0$.
I'm pretty sure I need to apply Ito's formula here but I'm not sure how. I tried making the substitution $Y_t = \sqrt{X_t}$ but have not yet been able to figure the problem out. I'm new to sdes and would really appreciate any help.
 A: Yes, we need to apply the Ito's formula. We denote $\tau = \inf\{t\geq 0 : X_t = 0\}$ and denote $W$ the Brownian motion.
For $t < \tau$, we can apply Ito's formula to the function $\phi(x) = \sqrt{x}$ using the Ito process $X$. Thus,
\begin{align}
dZ_t = d(\sqrt{X_t}) &= \frac{1}{2\sqrt{X_t}}dX_t - \frac{1}{8(X_t)^{\frac{3}{2}}}d\langle{X}\rangle_t\\
&=\frac{1}{2\sqrt{X_t}}\left(\left(\frac{b^2}{4} - X_t\right)dt + b\sqrt{X_t}dW_t\right) - \frac{1}{8\sqrt{X_t}}b^2dt\\
&=-\frac{1}{2}\sqrt{X_t}dt + \frac{b}{2}dW_t \\
&=-\frac{1}{2}Z_tdt + \frac{b}{2}dW_t \\
\end{align}
This yields to linear SDE which can be easly solved as follows:
Applying IPP to $\{Y_t = e^{\frac{t}{2}}Z_t\}_{t\geq0}$, we have that:
\begin{align}
dY_t &= \frac12Y_tdt + e^{\frac{t}{2}}dZ_t \\
&= \frac12Y_tdt + e^{\frac{t}{2}}\left(-\frac{1}{2}Z_tdt + \frac{b}{2}dW_t\right)\\
&= e^{\frac{t}{2}}\frac{b}{2}dW_t
\end{align}
Thus, $Y_t = Y_0 + \frac{b}{2}\int_0^te^{\frac{s}{2}}dW_s$ and $Y_0 = \sqrt{x}$. Tracing back to the initial quantity, we have
\begin{align}
X_t &= e^{-t}(Y_t)^2 \\
&= e^{-t}\left(\sqrt{x} + \frac{b}{2}\int_0^te^{\frac{s}{2}}dW_s\right)^2
\end{align}
Note that the function $\phi$ is well defined here because the CIR process is always positive for the given parameters.
