I've started reading Landau-Lifshitz Mechanics, and I'm having trouble with the problem at the end of section 7.
A particle of mass $m$ moving with velocity $\mathbf{v}_1$ leaves a half-space in which its potential energy is a constant $U_1$ and enters another in which its potential energy is a different constant $U_2$. Determine the change in the direction of motion of the particle.
The text's solution makes use of the conservation of energy in the system. I don't follow how the energy is conserved here for two reasons:
- The discontinuity of the potential energy function $$U = \begin{cases}U_1 & \text{in the one half-space}\\ U_2 & \text{in the other half-space}\end{cases}$$ suggests to me that the Lagrangian $$L = T - U$$ is also discontinuous.
- The derivation of the conservation of energy in a closed system seems to rely on the Lagrangian being differentiable (I assume it's well-known, but I'll reproduce it here with specific attention to this problem). The total time derivative of the Lagrangian can be expressed as $$\frac{dL}{dt} = \sum_i \frac{\partial L}{\partial q_i}\dot{q_i} + \sum_i \frac{\partial L}{\partial \dot{q_i}} \ddot{q_i}$$ everywhere except the boundary between the two half-spaces (since not all of the derivatives $\partial L/\partial q_i $ exist on the boundary). Making use of Lagrange's equations to replace $\partial L/\partial q_i$ with $(d/dt) \partial L/\partial \dot{q_i}$, we obtain $$\begin{align} \frac{dL}{dt} &= \sum_i \dot{q_i} \frac{d}{dt} \left(\frac{\partial L}{\partial \dot{q_i}}\right) + \sum_i \frac{\partial L}{\partial \dot{q_i}} \ddot{q_i} \\ &= \sum_i \frac{d}{dt} \left(\dot{q_i} \frac{\partial L}{\partial \dot{q_i}}\right). \end{align}$$ (I won't reproduce any here, but the derivations I can find for Lagrange's equations also seem to assume that the Lagrangian is differentiable). This leads to the conclusion that $$\frac{d}{dt}\left(\sum_i \dot{q_i} \frac{\partial L}{\partial \dot{q_i}} - L\right) = 0$$ everywhere except the boundary between the two half-spaces, and hence the quantity $$E \equiv \sum_i \dot{q_i} \frac{\partial L}{\partial \dot{q_i}} - L$$ is constant over those two half spaces. I don't see why the two constant values should be the same.
What am I missing? What justifies the conservation of energy in this system?