I'm given the equation following equation for $x \in (0,1)$:
\begin{align} -u''(x)+u(x)=H(x) \\ u'(-1)=u'(1)=0 \end{align} where $H(x)=0$ on $(-1,0)$ and $H(x)=1$ on $[0,1)$.
Now I first need to show that there exists a unique weak solution to this problem and then compute the solution. For the first part I did the following: By multiplying with a test function $v$, partial integration and using the boundary conditions I can rewrite the problem to \begin{align} \int_{-1}^1 u'v' +uv dx = \int_{-1}^1 Hv dx= \int_0^1 v dx. \end{align} I define the first part as a bilinear form $a(u,v)$ and the second part as linear functional $f(v)$. Therefore, the problem is reduced to finding a $u \in H^1(0,1)$ such that for all $v \in H^1(0,1)$ it holds that \begin{align} a(u,v))=f(v) \end{align} To use Lax-Milgram I showed that $f$ is bounded and $a$ is bounded and coercive: \begin{align} |a(u,v)|\leq ||u'||_{L^2} ||v'||_{L^2} +||u||_{L^2} ||u||_{L^2} \leq 2||u||_{H^1} ||v||_{H^1} \\ a(u,u)=||u||^2_{L^2} \\ |f(v)|\leq \int_{-1}^1|v(x)|dx \leq ||v||_{L^2} \leq ||v||_{H^1} \end{align} Hence, by Lax-Milgram, I've shown that there exists a unique weak solution.
I'm struggling with the second part of the question which asks to compute the weak solution. I guessed that the solution could be $u=H$ and tried to verify it:
\begin{align} \int_{-1}^1 H(x)v'(x)+\int_{-1}^1 H(x)v(x)dx=\int_{-1}^1 \delta_0(x)v'(x)+\int_0^1 v(x)dx \stackrel{!}{=}\int_0^1 v(x)dx \end{align}
For the last equality to be true I'd need that $\int_{-1}^1 \delta_0 v'(x)=0$. I doubt that this is true, though I'm not sure. (I know that $\int_{-{\infty}}^{\infty} \delta_0 v'(x)=v'(0)$). Is my approach correct or is the solution completely different?
If we look to the EDO separately on $(-1,0)$ and $(0,1)$, while fixing the additional condition $u(0)= c$, we get the following differential equations $$ \begin{cases} -u'' + u = 0\\ u'(-1)=0, u(0)= c \end{cases}\qquad \begin{cases} -u'' + u = 1\\ u(0)=c, u'(1)= 0 \end{cases} $$
If we choose $c = \frac 12$, the concatenation of the two solutions is defined and is $C^1$ in $\mathbb{R}$: $$ u(x) = \begin{cases} \dfrac{e^{-x}+e^{x+2}}{2+2 e^2}, & x \leq 0\\[1em] -\dfrac{e^{2-x}+e^x-2-2 e^2}{2 \left(1+e^2\right)}, & x >0 \end{cases} $$
Questions you should consider: