I'm new to Itô calculus and currently examining a process with the dynamics: $$ dX_t = \mu dt + \sigma X_t dB_t,\quad 0\leq t\leq T < \infty, \quad X_0 = x $$ where $\{B_t, t\geq 0\}$ is a standard 1-dimensional Brownian motion. The task of the current exercise is to calculate $\mathbb{E}[X_T^2]$, any ideas on how to approach this?
I have tried defining a new process $Y_t=X_t^2$ and using Itô's formula but it doesn't seem to get my anywhere. Thankful for all input!
Remember that your notation $$ dX_t = \mu dt + \sigma X_t dB_t $$ is just a shorthand for $$ X_t=X_0 + \int_0^t \mu ds + \int_0^t\sigma X_sdB_s. $$ Now after applying Itô's lemma (which you have done correctly) you get $$ dX_t^2=(2\mu X_t+ \sigma^2 X_t^2)dt+2 \sigma X_t^2 dB_t. $$ Now taking the expectation you get \begin{align} E[X_t^2]& = E[X_0^2+ \int_0^t 2\mu X_s + \sigma^2 X_s ds+ \int_0^t 2 \sigma X_s^2 dB_s] \\ & = E[X_0^2]+2 \mu \int_0^t E[X_s]ds+ \sigma^2 \int_0^t E[X_s^2]ds + 0 \\ & = X_0^2 + 2 \mu \int_0^t E[X_s]ds+ \sigma^2 \int_0^t E[X_s^2]ds \end{align} where we used linearity of expectation, Fubini's theorem (to change the order of expectation and the integral) and the fact that the expectation of stochastic integral is zero.
Now this can be written as $$ \frac{d}{dt} E[X_t^2] = 2 \mu E[X_t]+ \sigma^2 E[X_t^2] = 2 \mu X_0+2\mu^2 t +\sigma^2E[X_t^2]. $$ This is because $E[X_t]=X_0+\mu t$. Solving this linear ODE gives you the solution.