# Finding solution of ODE using Laplace transform

Solve the following ODE with initial condition $$y(0)=0$$.

$$y'+2y=f(x)$$ where $$f(x)=0$$ if $$x>1$$ and $$f(x)=1$$ if $$0\leq x\leq 1$$.

I applied Laplace transform on both sides which gets

$$sY(s)+2Y(s)=\frac{1-e^{-s}}{s}$$ $$\Rightarrow Y(s)=\frac{1-e^{-s}}{s(s+2)}$$ $$=\frac{1}{s(s+2)}-\frac{e^{-s}}{s(s+2)}$$

Now I know inverse Laplace transform of $$\frac{1}{s(s+2)}$$ but how to find inverse Laplace transform of second term?

Or can we solve above ODE using different method?

• My mistake it is zero for values bigger than 1 Commented Dec 23, 2021 at 13:19

Assuming you still want to solve the problem using the method of Laplace transform. From your work, the Laplace transform $$Y(s)$$ of $$y(t)$$ satisfies $$Y(s) = \frac{1 - e^{-s}}{s(s + 2)} = \frac{1}{s(s + 2)} - \frac{e^{-s}}{s(s + 2)}.$$ You can check that $$\frac{1}{s(s + 2)} = \frac{1}{2s} - \frac{1}{2(s + 2)}.$$ To transform the second term, you would need to use the so-called Translation on the $$t$$-axis property: If the inverse Laplace transform of $$F(s)$$ is $$f(t)$$, then $$\mathcal{L}^{-1}\left\{F(s)e^{-cs}\right\} = f(t - c)H(t - c),$$ where $$H(t - c)$$ is the shifted Heaviside function. You can check that $$y(t)$$ is given by

$$y(t) = \frac{1}{2} - \frac{1}{2}e^{-2t} - H(t -1)\left[\frac{1}{2} - \frac{1}{2}e^{-2(t - 1)}\right].$$

The Laplace transform is a little bit of an overkill for tis equation. Variation of parameters does the trick:

the general solution of your equation is:

$$y(x) = c\cdot e^{-2 x} + e^{-2 x} \int_0^x e^{2 s} f(s) ds$$

Using your intial data and $$f$$ (it is not clearly defined) we end up with

\begin{align} y(x) &= e^{-2 x} \int_0^{\min(x,1)} e^{2 s} ds\\ &= e^{-2 x} \frac{e^{2\min(x,1)}-1}{2}\\ &= \frac{e^{2\min(0,1-x)}-e^{-2 x}}{2} \end{align}

That being said of course you equation can be solved with Laplace transform. You could handle the second term with a partial fraction decomposition and than use a table of standard transformations.