Initial-value problem with a forcing function that has step discontinuity Context
I am solving an equation of motion derived from a Lagrangian that has a discontinuous step in its potential at the origin. In other words
$$V(x) = \left(V_2-V_1\right)H(x) + V_1.$$
Based on this context, my question regards how to solve an initial-value problem to obtain  $\dot{x}$. Bare in mind that I can solve this problem using conservation of energy, but that won't teach me anything new with respect to how to utilize the Lagrangian formalism.
Question
I would like to solve the following initial value problem
$$   m\,   \ddot{x}    =  - \left[V_2 - V_1\right]\delta(x)$$
with the initial conditions
$$x(t_o) = x_o,~\text{where}~x_0<0,~\text{and}~\dot{x}(t_o) = v_o,~\text{where} ~v_0>0.$$
[In truth, I am interested only in $\dot x(t)$].
My Answer
For all values $x$ excepting at $x=0$, the mass is moving with constant velocity. As a consequence, I may write that $x=v\left(t-t_o\right)+x_o$. Therefore,
$$   m\,   \ddot{x}    =  - \left[V_2 - V_1\right]\delta\left(v\left(t-t_o\right)+x_o  \right).$$
Now, I integrate both sides with respect to time. I find
$$ m\, \int    \ddot{x} \,dt   =  - \left[V_2 - V_1\right] \int   \delta\left(v\left(t-t_o\right)+x_0  \right)\,dt.$$
Upon integrating the left-hand side, and re-adjusting the right-hand side, I obtain
$$ m\, \dot{x}  + k_1  =  - \left[V_2 - V_1\right] \int   \delta\left(v\,t-\left(v\,t_o-x_o\right)  \right)\,dt.$$
Now, I do a change of variables. Namely, that $s = v_o\,t$. I find that
$$ m\, \dot{x}  + k_1  =  - \left[V_2 - V_1\right] \int   \delta\left(s-\left(v_o\,t_o-x_o\right)  \right)\,\frac{ds}{v_o}.$$
Erroneously taking the integral on the right-hand side, I incorrectly find that
$$ m\, \dot{x}  + k_1  =  - \frac{\left[V_2 - V_1\right]}{v_o} H\left(s-\left(v_o\,t_o-x_o\right)  \right) + k_2 .$$
Now, since $s = v_o\,t$,  I have that
$$ m\, \dot{x}  + k_1  =  - \frac{\left[V_2 - V_1\right]}{v_o} H\left(v_o\left(t-t_o\right) +x_o \right) + k_2 .$$
Ultimately, for an as yet unknown constant $k$, I arrive at
$$  \dot{x}(t)    =  - \frac{\left[V_2 - V_1\right]}{m\,v_o} H\left(v_o\left(t-t_o\right) +x_o \right) + k  .$$
Upon satisfying the satisfy the boundary condition,
$$ \dot{x}(t_o)    =  - \frac{\left[V_2 - V_1\right]}{m\,v_o} H\left(v_o\left(t -t_o\right) +x_o \right) + k = k = v_o .$$
So, I erroneously find that
$$
\boxed{
 \dot{x}(t)    =  v_o - \frac{\left[V_2 - V_1\right]}{m\,v_o} H\left(v_o\left(t-t_o\right) +x_o \right)  .
}
$$
Remarks
I am not satisfied with my approach. It seems unwieldy, and is erroneous. If you have a more direct approach to solve the problem, then please consider posting it.
 A: One way to solve the equation is to first multiply with $\dot x(t)$:
$$
m\,\ddot{x}\dot{x}    =  - \left[V_2 - V_1\right]\delta(x)\dot{x}.
$$
Both sides can then be written as derivatives:
$$
\frac{d}{dt}\left(\frac12 m\dot{x}^2\right)
=
-\frac{d}{dt}\left(\left[V_2 - V_1\right]H(x)\right)
$$
so
$$
\frac12 m\dot{x}^2 = C - \left[V_2 - V_1\right]H(x)
$$
but this practically leads to conservation of energy which you didn't want to use.
A: Conservation of energy is the way to go. Since you mention Lagrangian mechanics, the discontinuous potential $H(x)$ means you'd either need to formulate the equations of motion in a weak sense, or let $V(x)$ be the limit of some regularized potential. However; since you insist, let us study directly
$$\tag{1}
mx''(t)=-\alpha\delta(x(t))
$$
The solution will be linear away from $x=0$. With the given initial condition, $x(t)$ will be zero exactly once, say at $t=t^*$. The piecewise solution is
$$\tag{2}
x(t)=\cases{v_0(t-t^*) &$t<t^*$\\
A(t-t^*) &$t>t^*$}
$$
We want to find the constant $A$. If we try to integrate (1) wrt $t$ we meet a nontrivial issue: $\delta(x(t))=\frac{\delta(t-t^*)}{|x'(t^*)|}$ (using the composition of delta with a function property, see here), but $x$ is not differentiable at $t^*$. I propose integrating (1) wrt $x$ by making the change of variables $u(x)=x'(t)$. Then (1) reads
$$\tag{3}
(u^2)'=-\frac{2\alpha}{m}\delta(x)
$$
Which we can integrate wrt $x$ across the singularity at $x=0$. Some care is required based on the sign of $A$. If $A>0$ the particle is 'transmitted', and by $\lim_{\epsilon\to 0}\int\limits_{-\epsilon}^\epsilon dx$ of (3) we have
$$\tag{4}
A^2-v_0^2=-\frac{2\alpha}{m}
$$
Exactly as you would find using conservation of energy. Thus
$$\tag{5}
A=+ \sqrt{v_0^2-\frac{2\alpha}{m}}
$$
Substituting into (2) you'd find that
$$ \tag{6}
x(t)=\cases{v_0(t-t^*) &$t<t^*$\\
\sqrt{v_0^2-\frac{2\alpha}{m}}(t-t^*) &$t>t^*$}.
$$
Upon taking the derivative, you'd have
$$ \tag{7}
v(t)=\cases{v_0  &$t<t^*$\\
\sqrt{v_0^2-\frac{2\alpha}{m}} &$t>t^* \qquad,\quad v_0^2>2\alpha/m $}
$$
If $A=0$ then $v_0^2=2\alpha/m$ and (1) will not be satisfied for $t>t^*$, this corresponds to the particle becoming 'trapped' at $x=0$.
The case $A<0$ remains, which corresponds to 'reflection', and where we cannot integrate (3) in the manner $\int\limits_{-\epsilon}^\epsilon dx$.  Idea: we integrate $\int\limits_{-\epsilon}^{-\epsilon} dx$ where from $-\epsilon \to 0$ we integrate $u_{t<t^*}$ and from $0 \to -\epsilon$ we integrate $u_{t>t^*}$. This leads to
$$\tag{8}
A^2-v_0^2=-\frac{2\alpha}{m}H(0)
$$
I assert that the physical value of $H(0)$ in this problem is $0$, in which case we have
$$
v(t)=\cases{v_0 & $t<t^*$\\-v_0 & $t>t^*$}
$$
as expected. The justification is entirely post-hoc, but should not trouble us: as we should not expect to get unique solutions to the differential equation (1).
A: I thought that it might be instructive to present an alternative approach that recasts the problem using a nascent Dirac Delta [1].  To that end we proceed.

Suppose $x_n(t)$ satisifies the differential equation
$$x_n''(t)=K\delta_n(x)\tag1$$
subject to the conditions $x_n(t_0)=x_0$ and $x'_n(t_0)=v_0$.  In $(1)$. $K=-(V_2-V_1)/m$ and $\delta_n(x)$ is the nascent Dirac Delta
$$\delta_{n}(x)=\begin{cases}n&,0<x<1/n\\\\0&,\text{elsewhere}\end{cases}$$

The solution to $(1)$ is given by
$$x_n(t)=\begin{cases}x_0+v_0(t-t_0)&,x_n<0\\\\\frac{nK}2 (t-t_1)^2+A(t-t_1)&,0<x_n<\frac1n\\\\B(t-t_2)+\frac1n\end{cases}\tag2$$
where $x_n(t_1)=0$, $x_n(t_2)=1/n$, and $A$ and $B$ are integration constants.

We determine $A$ and $B$, and $t_1$ and $t_2$ in $(2)$ by enforcing continuity of position and velocity at $x_n=0$ and $x_n=1/n$.  Proceeding, we find that for $v_0^2+2K\ge0$
$$\begin{align}
t_1&=t_0-x_0/v_0\\\\
A&=v_0\\\\
t_2&=t_1-\frac{v_0}{nK}+\frac{\sqrt{v_0^2+2K}}{nK}\\\\
B&=\sqrt{v_0^2+2K}
\end{align}$$

Finally, letting $n\to \infty$, we find that for $v_0^2+2K\ge0$, $x(t)=\lim_{n\to\infty}x_n(t)$ is given by
$$x(t)=\begin{cases}
x_0+v_0(t-t_0)&, x<0\\\\
\sqrt{v_0^2-2(V_2-V_1)/m}\,(t-t_1)&,x>0
\end{cases}$$
And we are done!
References
[1] https://en.wikipedia.org/wiki/Dirac_delta_function#nascent_delta_function
