Solving a SDE using Feynman-Kac Apologies for any mathematical abominations I'm about to perform!
I'm trying to solve the following SDE
$$\frac{\partial f}{\partial t}(t,x) + \frac{1}{2} \sigma^2x^2\frac{\partial^2 f}{\partial x^2}(t,x) = 0$$
$$F(T,x) = x^2$$
Where the solution can be shown to be $f(t,x) = x^2e^{\sigma^2(T-t)}$ for $0\leq t\leq T$.
By FK Formula
$f(t,x) = E[X^2_T \mid x_t = x]$
$dx_t = \sigma x^2 dB_t$     (This is the line where I think I've made a mistake)
That is $x_t = x_0 + \sigma x^2 B_t$
$f(t,x) = E[X^2_T \mid x_t = x]$
$E[X_t + \sigma x^2(B_T - B_t)^2 \mid X_t = x]$
So I think my $dx_t$ line is incorrect, I'm not sure how the $x^2$ term changes the $dx_t$, do I include the $x^2$ term with $\sigma$ or am I misunderstanding the FK formula.
Any help/working towards the solution is greatly appreciated!
 A: Here is an overview/sketch that I hope you may flesh out.
To solve the PDE,
$$f_t + 0.5\sigma^2 x^2 f_{xx}=0,$$
with terminal condition $f(T, x) = x^2$, we appeal to the Feynman-Kac connection. (Please excuse my use of subscripts for partial derivatives out of laziness).

Identifying the SDE
The FK says that the solution $f$ is a conditional expectation of the TC applied to an Ito diffusion:
$$f(t,x)= \mathbb{E}(X_T^2 | X_t =x),$$
where $dX_t = \sigma X_t dB_t$ and $B = (B_t)_{t \geq 0}$ is a Brownian motion. How we identified the correct SDE depends on the coefficients appearing in the above PDE. To put it in general terms, if we wanted to solve
$$f_t + \frac12 \sigma(x)^2 f_{xx}=0,$$
and then our SDE would satisfy
$$dX_t = \sigma(X_t) dB_t.$$
The special case here being $\sigma(x)=\sigma x$ (where $\sigma$ on the RHS is just a constant).

Computing the PDE solution
Now we identify $X$ is a GBM with zero drift, so that
$$X_t = X_0 e^{-0.5 \sigma^2 t +\sigma B_t},$$
which we can also write on $[t, T]$ as
$$X_T = X_t e^{-0.5 \sigma^2 (T-t) +\sigma B_{(T-t)}}.$$
Hence squaring and taking the conditional expectation $\mathbb{E}(\cdot | X_t=x)$ yields
$$f(t, x) = \mathbb{E}( X_t^2 e^{-\sigma^2 (T-t)} e^{2\sigma B_{(T-t)}} | X_t = x)$$
$$=X_t^2 e^{-\sigma^2 (T-t)} \mathbb{E}( e^{2\sigma B_{(T-t)}} | X_t = x)$$
$$=x^2 e^{-\sigma^2 (T-t)} e^{2 \sigma^2 (T-t)}$$
$$=x^2 e^{\sigma^2 (T-t)},$$
since we are conditioning on $X_t=x$ we can pull out $X_t^2$ and the non-random constant $e^{-\sigma^2 (T-t)}$ and finally we used the fact that $\mathbb{E}(e^{2\sigma B_{(T-t)}})$ is just the MGF, $M_{B_{(T-t)}}(s)$, of a $\mathcal{N}(0, T-t)$ RV evaluated at $s=2\sigma$.
Please comment if something is not clear or erroneous.
