# Chain rule for Ito's Lemma

The CIR short rate model is $$dr_t=k(\theta-r_t)dt+\sigma\sqrt{r_t}dW_t$$ under the risk-neutral measure. The bond price is of the form $$P(t,T)=A(t,T)e^{-B(t,T)r_t}$$ where the continuously compounded spot rate is an affine function of the short rate $r_t$. My question is, how should Ito's Lemma be applied to find $dP(t,T)$?

Here is my attempt: $$\ln P(t,T)=\ln A(t,T)-B(t,T)r_t$$ $$d\ln P(t,T)=d\ln A(t,T)-r_tdB(t,T)-B(t,T)dr_t$$ $$(d\ln P(t,T))^2=B(t,T)^2\sigma^2r_tdt$$ \begin{align} d(e^{\ln P(t,T)})&=P(t,T)\bigg(d\ln P(t,T)+\frac{1}{2}(d\ln P(t,T))^2\bigg)\\ &=P(t,T)\bigg(d\ln A(t,T)-r_tdB(t,T)-B(t,T)dr_t+\frac{1}{2}B(t,T)^2\sigma^2r_tdt\bigg)\\ &=\ldots\\ &=r_tP(t,T)dt-B(t,T)P(t,T)\sigma\sqrt{r_t}dW_t \end{align} Although I have followed the steps for Ito's Lemma, I seem to be missing a detail that will allow some terms to cancel out to produce the final line. Moreover the functions $A(t,T)$ and $B(t,T)$ are quite complex and I don't think differentiating them would be a good idea. $$A(t,T)=\bigg[\frac{2h\exp{\{(k+h)(T-t)/2\}}}{2h+(k+h)(\exp{\{(T-t)h\}-1})}\bigg]^{2k\theta/\sigma^2}$$ $$B(t,T)=\frac{2(\exp{\{(T-t)h\}-1)}}{2h+(k+h)(\exp{\{(T-t)h\}-1})}$$ $$h=\sqrt{k^2+2\sigma^2}$$ Source: Brigo & Mercurio, Interest Rate Models, 3.2.3

You have to go start from the original expression of $P$:

$$P(t,T) = \mathbb{E}[e^{-\int_t^T r^s ds}|\mathcal{F}_t]$$

So if you define :

$$M_t = e^{-\int_0^t r_s ds}P(t,T)$$

this is a martingale.

So since you are in a brownian filtration,

$$dM_t = \sigma_t dW_t$$

It remains to find $\sigma_t$, which will be done by noticing that :

$$\sigma^2_t dt = d<M_t> = (e^{-\int_0^t r_s ds})^2 d<P(t,T)>$$

using your expression of $d<\ln P(t,T)>$ and since $d<P(t,T)>=P(t,T)^2 d<\ln P(t,T)>$ you get (using that $P(t,T)>0$)

$$dP(t,T) = r_t P(t,T) dt + P(t,T)\sqrt{\frac{d<\ln P(t,T)>}{dt}}dW_t$$