## Vasicek model

We derive the Vasicek term structure model formulae.

### Short Rate Dynamics

The short rate under the Vasicek model has the following dynamics:

$$d r_{t}= \kappa \left( \theta-r_{t} \right) dt + \sigma d w_{t}$$

Rearranging the equation, multiplying both sides by the integrating factor, and integrating from s to T, we get:

$$d r_{t} =\kappa \theta dt -\kappa r_{t} dt + \sigma d w_{t}$$ $$d r_{t}+ \kappa r_{t} dt = \kappa \theta dt + \sigma d w_{t}$$ $$e^{\kappa t} d r_{t} + \kappa e^{\kappa t} r_{t} dt =e^{\kappa t}\kappa\theta dt + e^{\kappa t} \sigma d w_{t}$$ $$d \left( e^{\kappa t} r_{t} \right) = e^{\kappa t}\kappa\theta dt + e^{\kappa t} \sigma d w_{t}$$ $$\int_{s}^{t} {d \left( e^{k u} r_{u} \right)} = \kappa \theta \int_{s}^{t}{e^{\kappa u} du} +\sigma\int_{s}^{t} {e^{k u} d w_{u}}$$ $$e^{\kappa t} r_{t} -e^{\kappa s} r_{s} = \kappa \theta \frac{\left( e^{\kappa t}-e^{\kappa s}\right)}{\kappa} + \sigma\int_{s}^{t} {e^{k u} d w_{u}}$$ $$r_{t} = r_{s}e^{-\kappa \left( t-s\right)}+ \theta \left( 1-e^{-\kappa \left( t-s \right) }\right) +\sigma\int_{s}^{t} {e^{-k \left( t- u \right) } d w_{u}}$$

Which is Gaussian with mean and variance given by,

$$E \left[ r_{t} \mid r_{s} \right]= r_{s}e^{-\kappa \left( t-s\right)}+ \theta \left( 1-e^{-\kappa \left( t-s \right) }\right)$$ $$V \left[ r_{t} \mid r_{s} \right]= V \left[ \sigma \int_{s}^{t} {e^{-\kappa \left(t-u \right)} d w_{u}} \right] = {\sigma}^{2} \int_{s}^{t} {e^{-2 \kappa \left(t-u \right)} du}=\frac{{\sigma}^2}{2{\kappa}} {\left( 1- e^{-2 \kappa \left( t -s \right)} \right)}$$