# Find a PDE for $f$ satisfying $f(t,Y_t) = \exp(- \frac{\gamma^2}{2} t + \gamma W_t) E[\exp(\frac{\gamma^2}{2} T - \gamma W_T) F(Y_T) | \mathcal{F}_t]$

I am studying a course on Stochastic Calculus for Finance and am struggling with the following question:

Given $$dY_t = b(t,Y_t) \, dt + \sigma(t, Y_t) \, dW_t$$ where $$\gamma \neq 0$$, and $$f(t,Y_t) = \exp\left(- \frac{\gamma^2}{2} t + \gamma W_t\right) \mathbb{E}\left[\exp\left(\frac{\gamma^2}{2} T - \gamma W_T\right) F(Y_T) \mid \mathcal{F}_t \right]$$ Find a PDE for $$f$$.

This clearly relates to Feynman-Kac Theorem but as there are Brownian Motion terms in the expression for $$f$$, this is not in the form that I am familiar with. Here is the version of the theorem that I am familiar with:

Feynman Kac: If a process $$Y$$ satisfies the SDE $$dY_t = b(t,Y_t)dt + \sigma (t, Y_t) dW_t$$ Then suppose $$f(t,y) \in C^{1,2}$$ and solves the PDE: $$f_t + \frac{1}{2} \sigma ^2 (t,y) f_{yy} + b(t,y) f_y - \delta(t,y) f = 0$$ with the terminal condition: $$f(T,y) = F(y)$$ Then under suitable assumptions, the function $$f$$ has the expression: $$f(t,Y_t) = \mathbb{E}[ \exp ( - \int _t^T \delta(s,Y_s) ds) F(Y_T) | \mathscr{F}_t]$$

As mentioned, the Brownian Motion terms in the exponential (in the question) make it unclear whether or not I am able to apply the theorem without some sort of manipulation.

A possible avenue to explore: I have also noticed that the exponentials both look like changes of measure. I know that we can define $$\exp\left(- \frac{\gamma^2}{2} t + \gamma W_t\right)$$ as $$\frac{d \mathbb{Q}}{d \mathbb{P}}$$ given $$\mathscr{F}_t$$ and so $$\exp\left(\frac{\gamma^2}{2} T - \gamma W_T\right)$$ would be $$\frac{d \mathbb{P}}{d \mathbb{Q}}$$ given $$\mathscr{F}_T$$. But this seems to complicate things when I try to substitute these expressions in.

Note that we can rewrite the random variable in the following way: \begin{aligned} &e^{-\gamma^2t/2+\gamma W_t}E^P[e^{\gamma^2T/2-\gamma W_T}F(Y_T)|\mathscr{F}_t]\\ &=e^{-\gamma^2t/2+\gamma W_t}E^P[e^{\gamma^2T/2-\gamma W_T}F(Y_T)e^{\gamma^2(T-t)}e^{-\gamma^2(T-t)}|\mathscr{F}_t]\\ &=e^{\gamma^2t/2+\gamma W_t}E^P[e^{-\gamma^2T/2-\gamma W_T}F(Y_T)e^{\gamma^2(T-t)}|\mathscr{F}_t] \end{aligned} Now note that the martingale $$L_s:=e^{-\gamma^2s/2-\gamma W_s},\,s\leq T$$ defines the change of probability measure $$dQ=L_TdP$$ s.t., in particular, for any $$Z$$ $$\mathscr{F}_T$$-measurable we have $$L_t^{-1}E^P[L_TZ|\mathscr{F}_t]=E^Q[Z|\mathscr{F}_t]$$. Therefore we can write: $$e^{-\gamma^2t/2+\gamma W_t}E^P[e^{\gamma^2T/2-\gamma W_T}F(Y_T)|\mathscr{F}_t]=E^Q[F(Y_T)e^{\gamma^2(T-t)}|\mathscr{F}_t]$$ Recall the theorem of Girsanov which tells us that $$W_t^Q:=W_t+\gamma t$$ is a $$Q$$-Brownian motion for $$t\leq T$$. We get the $$Q$$-dynamics of $$(Y_t)_{t\leq T}$$ as following: \begin{aligned} dY_t&=b(t,Y_t)dt+\sigma(t,Y_t)dW_t\\ &=(b(t,Y_t)-\gamma \sigma(t,Y_t))dt+\sigma(t,Y_t)dW_t^Q \end{aligned} What is left is to apply Feynman-Kac: the function $$f(t,Y_t)=E^Q[F(Y_T)e^{\gamma^2(T-t)}|\mathscr{F}_t]$$ solves the terminal value problem on $$[0,T]\times \mathbb{R}$$ $$\begin{cases} \partial_tf(t,y)+(b(t,y)-\gamma \sigma(t,y))\partial_y f(t,y)+\frac{1}{2}\sigma^2(t,y)\partial_{yy}f(t,y)+\gamma^2f(t,y)=0\\ f(T,y)=F(y) \end{cases}$$