Weak derivative of a given function

Integrate by parts once more on the first integral and evaluate the second:

$$-\phi(1)+\int_0^1\phi(x)dx+2\phi(1)=\phi(1)+\int_0^1\phi(x)dx.$$

So $v(x)=1$ on $[0,1)$, 0 on (1,2] and $\delta(x-1)$ at $x=1$. Explicitly:

$$v(x)=\delta(x-1)+1_{[0,1)}(x)$$


Taking any test function $\phi \in C_0^\infty((0,2))$ and using the definition of weak derivative you get (integrating by parts and noting that $\phi(0)=\phi(2)=0$) \begin{align*} (u',\phi) = -(u,\phi') & = - \int_0^2 u(x) \phi'(x) dx = - \int_0^1 x \phi'(x) dx - \int_1^2 2 \phi'(x) dx \\ & = -[x\phi(x)]_0^1 + \int_0^1 \phi(x) dx - 2 [\phi(x)]_1^2 \\ & = -\phi(1) + 0 + \int_0^1 \phi(x)dx - 2 \cdot 0 + 2\phi(1) \\ & = \phi(1) + \int_0^1 \phi(x)dx = (\delta(x-1), \phi) + (1_{[0,1]},\phi). \end{align*} and so (in the sense of distributions) $$ u'(x) = \delta(x-1) + 1_{[0,1]}(x). $$