# Solve a differential equation with an integral inside?

I am trying to solve this differential equation in Mathematica:

y'[t]+integral from 0 to t of y[x]dx =e^(-t) where y[0]=0.

Is this possible?

## Method 1, using Laplace transform

eq = y'[t] + Integrate[y[x], {x, 0, t}] == Exp[-t];
eq = LaplaceTransform[eq, t, s];
eq /. LaplaceTransform[y[t], t, s] -> U0
sol = Solve[%, U0]
Simplify@InverseLaplaceTransform[U0 /. sol, s, t]
% /. y[0] -> 0


## Method 2, convert to second order ODE

You can, but you are missing a second initial condition. This is second order ODE actually. Assuming y'[0]==0

eq = y'[t] + Integrate[y[x], {x, 0, t}] == Exp[-t];
eq = D[eq, t];


The above is the ODE you want to solve.

DSolve[{eq, y[0] == 0, y'[0] == 0}, y[t], t]


• How can you use a laplace transform in mathematica to solve this? – Jimmeny Dec 12 '14 at 0:34
• @NimblePawn added Laplace method. Not sure why -Sin[t] shows up in the ODE method vs. +Sin[t] in the Laplace now. But these are two methods I know about. The correct answer with zero IC should be the ODE based one. with -sin. – Nasser Dec 12 '14 at 0:36
• I'm not sure why either. That is pretty strange. Thank you for the help! – Jimmeny Dec 12 '14 at 0:43
• @Nasser Nice answer :).The problem with the sign comes from a wrong assumption for y'[0] If you look at the original equation you' ll most certainly find that it should be y'[0] == 1 – Dr. belisarius Dec 12 '14 at 7:08