I am reading the book Simulation and Inference for Stochastic Differential Equations with R Examples. In the middle of page 44, there is a solution for $X_t e^{\theta_2t}$. I couldn't derive the same result.
According to the book, $$ dX_t = (\theta_1-\theta_2X_t)dt + \theta_3 dW_t, ~~X_0=x_0 $$ with $\theta_3\in \mathbb{R}_+$ and $\theta_1$,$\theta_2 \in \mathbb{R}$.
We choose $f(t,x) = x~e^{\theta_2 t}$, and its first derivative with respect to $t$, its first derivative with respect to $x$, and its second derivative with respect to $x$ are $$ f_t(t,x) = \theta_2~f(t,x) $$
$$ f_x(t,x) = e^{\theta_2 t} $$
$$ f_{xx} (t,x) = 0 $$
The solution from the book is $$ X_t e^{\theta_2 t} = f(t,X_t)=f(0,X_0)+\int_{0}^{t}\theta_2X_ue^{\theta_2u}du+\int_{0}^{t}e^{\theta_2u}dX_u $$ $$ =x_0 + \int_{0}^{t}\theta_2 X_u e^{\theta_2u}du+\int_{0}^{t}e^{\theta_2u}\big\{(\theta_1 - \theta_2X_u)du + \theta_3 dW_u \big\} $$ $$ =x_0+\frac{\theta_1}{\theta_2}\big(e^{\theta_2 t} -1\big) + \theta_3 \int_{0}^{t}e^{\theta_2 u} dW_u $$
But my solution is
$$ X_t e^{\theta_2 t} = f(t,X_t)=f(0,X_0)+\int_{0}^{t}\theta_2X_ue^{\theta_2u}du+\int_{0}^{t}e^{\theta_2u}dX_u $$ $$ =x_0 + \int_{0}^{t}\theta_2 X_u e^{\theta_2u}du+\int_{0}^{t}e^{\theta_2u}\big\{(\theta_1 - \theta_2X_u)du + \theta_3 dW_u \big\} $$ $$ =x_0+ \int_{0}^{t}e^{\theta_2 u} \theta_1 du + \theta_3 \int_{0}^{t}e^{\theta_2 u} dW_u $$ $$ = x_0+ e^{\theta_2 t} \theta_1 t + \theta_3 \int_{0}^{t}e^{\theta_2 u} dW_u $$
What is my mistake?
Thanks!
In the very last line you didn't calculate the integral
$$\int_0^t e^{\theta_2 u} \theta_1 \, du$$
correctly. Note that
$$\int_0^t e^{\theta_2 u} \theta_1 \, du= \frac{\theta_1}{\theta_2} (e^{\theta_2 t}-1).$$