# Weak derivative of a given function

$\def\d{\mathrm{d}}$Find the weak derivative of the following function: $$u(x)=\begin{cases}x; & x\in(0,1]\\2; & x\in (1,2]\end{cases}.$$

We have,\begin{align*} \int_0^2v(x)\phi(x)\,\d x&=\int_0^2 u'(x)\phi(x)\,\d x=-\int_0^2 u(x)\phi'(x)\,\d x\\ &=-\int_0^1x\phi'(x)\,\d x-\int_1^22\phi'(x)\,\d x. \end{align*} Then how I can proceed to find the weak derivative of $u(x)$?

## 2 Answers

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).$$