# Derivation of CIR interest rate model [duplicate]

I am trying to understand the derivation of the Cox-Ingersoll-Ross interest rate model. This has a stochastic differential equation of the form

$$dr=(\eta-\gamma r)dt + \sqrt{\alpha r} \space dX$$

With an affine solution of the form

$$V(r,t;T)=\exp\left[A(t) - rB(t)\right]$$

Putting this into the bond pricing equation and solving for $$A(t;T)$$ and $$B(t;T)$$ we arrive at a linear ODE for $$B(t;T)$$ in the form

$$\frac{d B(t;T)}{dt} = \frac{1}{2}\alpha (B(t;T))^2 + \gamma B(t;T) - 1$$

I need to solve this ODE to get the final solution for $$B(t;T)$$ in the form

$$B(t;T) = \frac{2\left(e^{\psi_1(T-t)}-1\right)}{(\gamma + \psi_1)(e^{\psi_1(T-t)}-1) + 2\psi_1}$$

Where

$$\psi_1=\sqrt{\gamma^2 + 2\alpha}$$

I can't think where to start solving this ODE. Could someone please give me a clue?