# Find a weak solution of the ODE

Find a weak solution to the following ODE:

$$u' + u = H_0(x)$$ where $$H_0(x) = \begin{cases} 0 & x < 0 \\ 1 & x \geq 0 \end{cases}$$

My professor advised that we try to guess the solution and then verify it. My first guess was naive because I did not know the "derivative" (I put quotes here because this isn't really a derivative) of $$H_0(x)$$ was $$\delta_0(x)$$. I thought it was $$0$$. I still state this because something consistent is happening.

If you do guess $$u = H_0$$, we can go ahead and attempt to find the weak derivative. Consider $$\phi \in C_{c}^{\infty}$$ (continuous functions with compact support)

Then,

$$\displaystyle-\int_{-\infty}^{\infty} \phi'(x)u(x)dx = -\int_{-\infty}^{0} \phi'(x) * 0 dx - \int_{0}^{\infty} \phi'(x) * 1 dx$$

Using integration by parts,

$$\displaystyle-[\phi(x) * 0 |_{-\infty}^{0} + \int_{-\infty}^{0} \phi(x) * 0 dx - [\phi(x) * 1 |_{0}^{\infty} + \int_{0}^{\infty} \phi(x) * 0 dx$$

The first term is $$0$$ due to the multiplication. The third term only leaves the lower limit because $$\phi$$ is compactly supported. Therefore, I am left with

$$\displaystyle\boxed{\phi(0)} + \int_{-\infty}^{\infty} \phi(x) * 0 dx$$.

This is very close to what I wanted, but I have an extra $$\phi(0)$$.

After our next lecture, I found out that the weak derivative of $$H_0(x)$$ does not exist and we need the distribution derivative to make it $$\delta_0(x)$$. Therefore, I knew my initial guess was wrong.

My next guess was to solve the ODE for both "components." What I mean is solve $$u'+u = 0$$ and $$u' + u = 1$$. Just to see if this worked, I first plugged these into wolfram alpha and got $$c e^{-x}$$ and $$c e^{-x} + 1$$ respectively. Therefore, my guess was $$u = \begin{cases} ce^{-x} & x < 0 \\ ce^{-x} + 1 & x \geq 1 \end{cases}$$.

Now, I attempted to find $$u'$$

\begin{align}&-\int_{-\infty}^{\infty} \phi'(x) u(x) dx = -\int_{-\infty}^{0} \phi'(x) ce^{-x} dx - \int_{0}^{\infty} \phi'(x) (ce^{-x}+1) dx \\&= -\int_{-\infty}^{0} \phi'(x) ce^{-x} dx - \int_{0}^{\infty} \phi'(x) ce^{-x} dx - \int_{0}^{\infty} \phi'(x) dx\\ &= -\int_{-\infty}^{\infty} \phi'(x) ce^{-x} dx - [\phi(x) |_{0}^{\infty} \\ &= -[\phi(x) ce^{-x} |_{-\infty}^{\infty} + \int_{-\infty}^{\infty} \phi(x) (-ce^{-x} dx) + \phi(0)\\ &= \boxed{\phi(0)} + \int_{-\infty}^{\infty} \phi(x) (-ce^{-x})dx\\ \end{align}.

Again. $$\phi(0)$$ is there, At this point, I asked my professor if he could give me a hint. He told me my initial guess should be the solution to the ODE involving each component, which is exactly what I did. Since I did get the solutions through wolfram alpha,I went ahead and solved both ODEs by hand just to make sure something weird didn't happen. I ended up with $$ce^{-x}$$ and $$1 - ce^{-x}$$ respectively.

While the second one is slightly different, it shouldn't make a difference because $$c$$ is a constant, so it could "absorb" the $$-$$ sign. I won't go through the details again, but one will end up with

$$\displaystyle\boxed{\phi(0)} + \int_{-\infty}^{0} \phi(x) (-ce^{-x}) dx + \int_{0}^{\infty} \phi(x) (ce^{-x}) = \boxed{\phi(0)} + \int_{-\infty}^{\infty} \phi(x) u'(x) dx$$ where $$u'(x) = \begin{cases} -ce^{-x} & x < 0 \\ ce^{-x} & x \geq 1 \end{cases}$$.

Again, the $$\phi(0)$$ is still there and I'm not sure how to get rid of it! Does anyone see what I'm doing wrong? Is my initial guess still wrong?

Thanks!

• I don't know that I should give you a hint or not? because I often give this example to my students, lol ^^ Oct 15 at 14:31
• $u'+u$ is the sort of thing that should remind you of integrating factors: if $v= e^x u$ then $v'=e^x(u'+u)$. Then you can directly integrate for the guessing Oct 15 at 14:57

In your attempt for the piecewise solution you get different constants for both regions and have to ensure the continuity of the solution $$u(x)=\begin{cases}c_1e^{-x}&x<0\\1+c_2e^{-x}&x\ge 0\end{cases}$$ with $$c_1e^0=1+c_2e^0$$ so that $$u(x)=\begin{cases}ce^{-x}&x<0\\1+(c-1)e^{-x}&x\ge 0\end{cases} \\=ce^{-x}+H_0(x)(1-e^{-x})$$

You could also work with an integrating factor $$(e^xu(x))'=H_0(x)e^x\implies e^xu(x)=c+H_0(x)(e^x-e^0)$$

• This perfectly explained what I missed! I would have never found that on my own, I wasn't even thinking about it. That literally slipped my mind. Thanks for clarifying! Oct 15 at 22:54

This is what my knowledge allows me:

Given differential system $$\dot{x} = A \, x + B \, u$$, and output $$y = C \, x$$, its solution is below.

$$x(t, \tau) = e^{A(t - \tau)} x(\tau) + \int^{\tau}_{t} \, e^{A \, (t - s)} \, B \, u(s) \, ds$$

Suppose $$u(s) = H_0(s)$$ as you state. Hence, the solution for it is the equality below. THem matrix $$X$$ corresponds to the integral $$\int^{\tau}_{t} \, e^{- A \, s} ds$$. Finally, the output is $$y(t, \tau) = C \, e^{A(t - \tau)} x(\tau) + C \, e^{A \, t} \, X(t, \tau) \, B$$

\begin{aligned} x(t, \tau) & = e^{A(t - \tau)} x(\tau) + \int^{\tau}_{t} \, e^{A \, (t - s)} \, B \, H_0(s) \, ds \\ & = e^{A(t - \tau)} x(\tau) + e^{A \, t} \, \left( \int^{\tau}_{t} \, e^{- A \, s} ds \right) B \\ & = e^{A(t - \tau)} x(\tau) + e^{A \, t} \, X(t, \tau) \, B \end{aligned}

For your case, matrix $$A$$ is a scalar $$-1$$, B is the scalar $$1$$ and C is the scalar $$1$$. Therefore, the solution is

\begin{aligned} u(t, 0) = u(t) & = e^{-t} x(0) + e^{-t} \, X(t, 0) \\ & = e^{-t} x(0) + e^{-t} \, (e^t - 1) \\ & = e^{-t} x(0) + e^{-t} \, (e^t - 1) \\ & = e^{-t} x(0) - e^{-t} + 1 \end{aligned}