Application of Ito's Lemma, finding the condition for the martingale

The Vasicek short rate model is $$dr_t=\kappa(\theta-r_t)dt+\sigma dW_t$$ Define the processes $x_t$ and $f(x,t)$ $$x_t=\frac{r_t}{\kappa}(1-e^{-\kappa(T-t)})+\int_0^tr_sds$$ $$f(x,t)=e^{a(T-t)-x_t}$$ Note that $a(t)$ is a function.

Question 1: Find $df(x,t)$ using Ito's Lemma.

My attempt: \begin{align} dx_t&=\frac{1-e^{-\kappa(T-t)}}{\kappa}dr_t+\frac{r_t}{\kappa}(-e^{-\kappa(T-t)})\kappa dt\\ &=\frac{1-e^{-\kappa(T-t)}}{\kappa}(\kappa(\theta-r_t)dt+\sigma dW_t)-r_te^{-\kappa(T-t)}dt\\ &=(1-e^{-\kappa(T-t)})(\theta-r_t)dt+\frac{\sigma}{\kappa}(1-e^{-\kappa(T-t)})dW_t-r_te^{-\kappa(T-t)}dt\\ &=\Big( (1-e^{-\kappa(T-t)})\theta-r_t+r_te^{-\kappa(T-t)}-r_te^{-\kappa(T-t)}\Big)dt+\frac{\sigma}{\kappa}(1-e^{-\kappa(T-t)})dW_t\\ &=\Big( (1-e^{-\kappa(T-t)})\theta-r_t\Big)dt+\frac{\sigma}{\kappa}(1-e^{-\kappa(T-t)})dW_t \end{align} $$(dx_t)^2=\frac{\sigma^2}{\kappa^2}(1-e^{-\kappa(T-t)})^2dt$$

$$\ln{f(x,t)}=a(T-t)-x_t$$ $$d\ln{f(x,t)}=d_ta(T-t)-dx_t=d_ta(T-t)-\Big( (1-e^{-\kappa(T-t)})\theta-r_t\Big)dt-\frac{\sigma}{\kappa}(1-e^{-\kappa(T-t)})dW_t$$ $$(d\ln{f(x,t)})^2=(dx_t)^2=\frac{\sigma^2}{\kappa^2}(1-e^{-\kappa(T-t)})^2dt$$ Applying Ito's Lemma to $f(x,t)$ \begin{align} d(e^{\ln{f(x,t)}})&=f(x,t)d\ln{f(x,t)}+\frac{1}{2}f(x,t)(d\ln{f(x,t)})^2\\ &=f(x,t)\Bigg(d_ta(T-t)-\Big( (1-e^{-\kappa(T-t)})\theta-r_t\Big)dt-\frac{\sigma}{\kappa}(1-e^{-\kappa(T-t)})dW_t\Bigg)+\frac{\sigma^2}{2\kappa^2}(1-e^{-\kappa(T-t)})^2dt\\ &=f(x,t)\Bigg(\frac{d}{dt}a(T-t)-\Big( (1-e^{-\kappa(T-t)})\theta-r_t\Big)+\frac{\sigma^2}{2\kappa^2}(1-e^{-\kappa(T-t)})^2\Bigg)dt-\frac{\sigma}{\kappa}(1-e^{-\kappa(T-t)})dW_t\\ \end{align} Question 2: Find the dynamics of the function $a(t)$ such that the process $f(x,t)$ is a martingale.

My attempt: $$\frac{d}{dt}a(T-t)-\Big( (1-e^{-\kappa(T-t)})\theta-r_t\Big)+\frac{\sigma^2}{2\kappa^2}(1-e^{-\kappa(T-t)})^2=0$$ $$\frac{d}{dt}a(T-t)=\Big( (1-e^{-\kappa(T-t)})\theta-r_t\Big)-\frac{\sigma^2}{2\kappa^2}(1-e^{-\kappa(T-t)})^2$$ $$d_ta(T-t)=\Bigg(\Big( (1-e^{-\kappa(T-t)})\theta-r_t\Big)-\frac{\sigma^2}{2\kappa^2}(1-e^{-\kappa(T-t)})^2\Bigg)dt$$

Can anyone confirm the correctness of my attempts? Any help is appreciated.

• Mistake: Extra $f(x,t)$ in the last 5 lines.
– none
Nov 4, 2016 at 8:43
• Then just edit the question to fix it. Also, please rephrase the title as a question.
– SRKX
Nov 4, 2016 at 9:42

Note $$dx_t=\frac{1-e^{-\kappa(T-t)}}{\kappa}dr_t-e^{-\kappa (T-t)}r_tdt+\frac{1}{\kappa}\underbrace{d\left[1-e^{-\kappa(T-t)}\,,\,r_t\right]}_{0}+r_tdt$$ thus $$dx_t=\frac{1-e^{-\kappa(T-t)}}{\kappa}dr_t+\left(1-e^{-\kappa (T-t)}\right)r_tdt\,.$$ In other words $$dx_t=\theta\left(1-e^{-\kappa(T-t)}\right)dt+\frac{1-e^{-\kappa(T-t)}}{\kappa}\sigma\,dW_t\,.\tag 1$$ By application of Ito's lemma, we have $$d\left(e^{-x_t}\right)=-e^{-x_t}dx_t+\frac{1}{2}e^{-x_t}\underbrace{d[x_t\,,x_t]}_{\frac{\left(1-e^{-\kappa(T-t)}\right)^2}{\kappa^2}\sigma^2dt}$$ therefore $$d\left(e^{-x_t}\right)=\left(-\theta\left(1-e^{-\kappa(T-t)}\right)+\frac{\left(1-e^{-\kappa(T-t)}\right)^2}{2\kappa^2}\sigma^2\right)e^{-x_t}dt-\sigma\frac{1-e^{-\kappa(T-t)}}{\kappa} e^{-x_t}dW_t\tag 2$$ as a result $$df(t,x)=e^{-x_t}d\left(e^{a(T-t)}\right)+e^{a(T-t)}d\left(e^{-x_t}\right)+\underbrace{d\left[e^{a(T-t)}\,,\,e^{-x_t}\right]}_{0}$$ in other words $$df(t,x)=\left(\frac{\left(1-e^{-\kappa(T-t)}\right)^2}{2\kappa^2}\sigma^2-\theta\left(1-e^{-\kappa(T-t)}\right)-a'(T-t)\right)e^{a(T-t)-x_t}dt-\sigma e^{a(T-t)-x_t}\frac{1-e^{-\kappa(T-t)}}{\kappa}dW_t$$ or $$df(t,x)=\mu(t,T)f(t,x_t)dt+\sigma(t,T)f(t,x_t)dW_t\tag 3$$ where $$\mu(t,T)=\left(\frac{\left(1-e^{-\kappa(T-t)}\right)^2}{2\kappa^2}\sigma^2-\theta\left(1-e^{-\kappa(T-t)}\right)-a'(T-t)\right)$$ and $$\sigma(t,T)=-\sigma \frac{1-e^{-\kappa(T-t)}}{\kappa}$$

• I missed the $r_tdt$! Beautiful answer.
– none
Nov 4, 2016 at 8:18
• Yes, you missed $r_t dt$. Now you can consider the question 2
– user16651
Nov 4, 2016 at 8:20
• In equation (2), the coefficient of $dW_t$ may be $-\frac{\sigma}{\kappa}(1-e^{-\kappa(T-t)})e^{-x_t}dW_t$
– none
Nov 4, 2016 at 8:32
• To answer question 2, I have $$\frac{d}{dt}a(T-t)=\theta(1-e^{-\kappa(T-t)})+\frac{\sigma^2}{2\kappa^2}(1-e^{-\kappa(T-t)})^2$$ It looks right.
– none
Nov 4, 2016 at 8:36
• Yes. Indeed you used the Martingale Representation Theorem (MRT)
– user16651
Nov 4, 2016 at 9:01