Show that a piecewise function of two solutions to an ODE is a solution to the ODE Let $x=x(t)$. If the first order ODE $x'=f(t,x) (*)$ is satisfied by $u$ and $v$, each over $I = (a,b)$, show that
$$w(t) := u1_{(a,t_0)} + v1_{[t_0,b)}$$
satisfies $(*)$, where
$u(t_0) = v(t_0)$ for some $t_0 \in (a,b)$.
So, we must show that $w'=f(t,w)$.
Not sure if it matters, but we can deduce that $u'(t_0) = v'(t_0)$.

What I tried:
$$LHS = w'(t) = u'(t) 1_{(a,t_0)} + v'(t) 1_{[t_0,b)}$$
$$RHS = f(t,w) = f(t, u(t) 1_{(a,t_0)} + v(t) 1_{[t_0,b)})$$
Is it okay to take cases? Is there another way to do it besides taking cases?
 A: We have $u'(t)=f(t,u(t))$ and $v'(t)=f(t,v(t))$.
Hence, for $t<t_0$ we have
$$w'(t)=u'(t)=f(t,u(t))=f(t,w(t)),$$
while for $t>t_0$,
$$w'(t)=v'(t)=f(t,v(t))=f(t,w(t)).$$
Moreover, since $u(t_0)=v(t_0)$, the function $w$ is continuous and $w$ is a (weak) solution of the differential equation.
Added:
To be a weak solution means that $w(t)=c+\int_{t_0}^t f(s,w(s))\,ds$ for all $t$ in some open neighborhood of $t_0$, where $c=u(t_0)=v(t_0)$. This means that in general we look for solutions that are at most continuous at $t_0$. In other words, and without further hypothesis, one cannot expect that $w$ is differentiable at $t_0$.
But, for example, if $f$ is locally Lipschitz in $x$, then the solutions are unique and of course $w$ will be differentiable at $t_0$ with $w'(t_0)=u'(t_0)=v'(t_0)$. However, in that case, the problem is not very interesting since than we have in fact $u(t)=v(t)$ in in some open neighborhood of $t_0$ (and so also $w(t)=u(t)=v(t)$ in in some open neighborhood of $t_0$).
