# Feynman-Kac to derive stochastic representation

$$u_t + \frac{1}{2}\sigma^2x^2u_{xx} - \alpha + \lambda((K_d - x)^+ - u) = 0$$ with terminal condition $$u(T, X) = (K_m - X(T))^+$$

$$dX = \sigma X(t)dW_t$$

$$\alpha$$ and $$\lambda$$ are constants

Ok so using Feynman-Kac (courtesy of Wikipedia) I came to the conclusion that I need to calculate the expectation of the following thing:

$$u(t, x) = E[\int_t^T (\lambda(K_d - X(r))^+ - \alpha)e^{-\int_t^r \lambda d\tau}dr + e^{-\int_t^T \lambda d\tau}(K_m - X(T))^+ |X(t) = x]$$

Using Ito's lemma I derived that $$X(T) = X(t)e^{-\frac{1}{2}\sigma^2(T-t) + \sigma W_{T-t}}$$. Then, since $$\lambda$$ is a constant, I ended up with

$$u(t,x) = E[\int_t^T(\lambda(K_d - X(r))^+ - \alpha)e^{\lambda(t-r)}dr + e^{\lambda(t-T)}(K_m - X(T))^+|X(t) = x]$$

Now, the second part of the equation is the standard put option calculation $$E[(K - S)^+]$$ which is the BS formula for put, but what about the first one? For some reason I just can't figure out how to deal with this outer integral. Or maybe I'm completely wrong and made a mistake somewhere?

I'd be glad for some help.