Integrating factor in optimal control theory

Hey guys,

This is an optimal control problem for an econ class but it is the maths behind it I am struggling with - so have left the context out. I have derived two differential equations in my state and costate variables:

costate:$\displaystyle \frac {dy} {dt} = Ae^{(r+\beta)t}$

state: $\displaystyle \frac {dk} {dt} = \beta k - (Ae^{(r+\beta)t})^2 $

where $\displaystyle A $ is some arbitrary constant.

Now i need to solve $\displaystyle \frac {dk} {dt}$ for $\displaystyle k$

Using the integrating factor I get:

$\displaystyle K = Ce^{\beta t} - \frac {A^2e^{(4r+4\beta)t}} {4r+3\beta}$

Where $\displaystyle C$ is another arbitrary constant. Is this right?

I then have to apply the transversality condition:

$\displaystyle e^{-rt} k(t) y(t) = 0 $

Which using my solutions for $\displaystyle k$ and $\displaystyle y$ is:

$\displaystyle ACe^{2\beta t} - \frac {A^3e^{(4r+5\beta)t}} {4r+3\beta} = 0$

I won't go any further with the problem here because I am convinced I have gone wrong somewhere since the equation isn't very pretty :( can anyone check my value for $\displaystyle k$ please?