Solution to a differential equation with final value

168 Views Asked by At

I've seen the following differential equation with a final value in a book:

$\dot{x}=J(y) \, e^{-r(t-t_f)}$, $x(t_f)=P$ where $t_f$ is a fixed final time. The solution given is: $x(t)=P-\int_t^{t_f} J(y)\, e^{-r(\tau - t_f)} d\tau$.

I tried solving the problem by separating the variables: $\int dx = \int J(y) e^{-r(\tau - t_f)} d\tau$ which gives $x(t)= \int J(y) e^{-r(\tau - t_f)} d\tau + C$. However, I'm not sure what the limits of the integration should be since we're solving backwards. If I put from $t$ to $t_f$, then since $x(t_f)=P$, I get $C=P$. The solution is similar to one in the book but with a + instead of - . What am I missing here?

Thanks, Sami