# Simple HJM model, differentiating the bond price

We have the following simple HJM model $$f(t,T)=f(0,T)+\int_0^t\alpha(s,T)ds+\sigma W_t$$ $$r_t=f(0,t)+\int_0^t\alpha(s,t)ds+\sigma W_t$$ $$P(t,T)=\exp-\bigg(\int_t^Tf(0,u)du+\int_0^t\int_t^T\alpha(s,u)duds+\sigma(T-t)W_t\bigg)\tag{1}$$ $$\alpha(t,T)=\sigma^2(T-t)+\sigma\gamma_t$$ Then by Ito's Lemma $$d_tP(t,T)=P(t,T)\Big(-\sigma(T-t)dW_t+(r_t-\sigma(T-t)\gamma_t)dt\Big)\tag{2}$$ My question is, how do we get from (1) to (2)?

I have attempted the following $$P(t,T)=e^{-X_t}$$ $$X_t=\int_t^Tf(0,u)du+\int_0^t\int_t^T\alpha(s,u)duds+\sigma(T-t)W_t$$ \begin{align} \frac{d}{dt}\int_0^t\int_t^T\alpha(s,u)duds&=\int_0^t\bigg(\frac{\partial}{\partial t}\int_t^T\alpha(s,u)ds\bigg)ds+\int_t^T\alpha(t,u)du\\ &=-\int_0^t\alpha(s,t)ds+\int_t^T\alpha(t,u)du\\ \end{align} \begin{align} dX_t&=-f(0,t)dt-\int_0^t\alpha(s,t)ds+\int_t^T\alpha(t,u)du-\sigma W_tdt+\sigma(T-t)dW_t\\ &=\bigg(\int_t^T\alpha(t,u)du-r_t\bigg)dt+\sigma(T-t)dW_t \end{align} \begin{align} d_tP(t,T)&=-P(t,T)dX_t+\frac{1}{2}P(t,T)\sigma^2 (T-t)^2dt\\ &=-P(t,T)\Bigg(\bigg(\int_t^T\alpha(t,u)du-r_t\bigg)dt+\sigma(T-t)dW_t\Bigg)+\frac{1}{2}P(t,T)\sigma^2 (T-t)^2dt\\ &=P(t,T)\Bigg(\bigg(r_t-\int_t^T\alpha(t,u)du+\frac{1}{2}\sigma^2 (T-t)^2\bigg)dt-\sigma(T-t)dW_t\Bigg) \end{align} Thus if I have been correct so far, it would imply that $$\int_t^T\alpha(t,u)du-\frac{1}{2}\sigma^2 (T-t)^2=\sigma(T-t)\gamma_t\tag{3}$$ with the change of measure satisfying the condition $$\alpha(t,T)=\sigma^2(T-t)+\sigma\gamma_t$$ I am unable to show the equality in (3), that is if I haven't made any mistakes in the previous working.

Any help is appreciated.

Identity $(3)$ obviously holds if $$\alpha(t, T) = \sigma^2(T-t) +\sigma \gamma_t,$$ since \begin{align*} \int_t^T \alpha(t, u)du &= \int_t^T\left(\sigma^2(u-t) +\sigma \gamma_t \right)du\\ &=\frac{1}{2}\sigma^2(T-t)^2 + \sigma \gamma_t (T-t). \end{align*}