Can the relative position of two masses connected by a spring become negative? 
Consider the following diagram. Two masses of 1 kilogram each are attached by a spring of 1 N/m. The $x$-axis is chosen such that $x_1(0)=0$ and $x_2(0)=L$ where $L$ is the length of the spring in relaxation (no restoring force acting on the masses).
At $t=0$ the speed of the first mass on the left is $v$ directed to the right. The objective is to find the relative position of the masses, $d(t)=x_2(t)-x_1(t)$ for $t \ge0$.


My attempt
Initial condition
$$
\begin{cases}
x_1(0)=0\\
\dot{x}_1(0)=v \\
x_2(0)=L\\
\dot{x}_2(0)=0 \\
\end{cases}
$$
Applying Newton's second law to the first mass:
\begin{align*}
\ddot{x}_1(t) &=-(x_1-x_2)\\
s^2 X_1 -s x_1(0) -\dot{x}_1(0) &= -(X_1-X_2) \\
s^2 X_1  -v &= -(X_1-X_2) \\
(s^2+1) X_1  -X_2 &= v
\end{align*}
Applying Newton's second law to the second mass:
\begin{align*}
\ddot{x}_2(t) &=-(x_2-x_1)\\
s^2 X_2 -s x_2(0) -\dot{x}_2(0) &= -(X_2-X_1) \\
s^2 X_2  -sL -0 &= -(X_2-X_1) \\
-X_1 + (s^2+1) X_2  &= sL
\end{align*}
Solving the simultaneous equations, I  have
\begin{align*}
X_1 &= \frac{(s^2+1)v+sL}{s^2(s^2+2)} \\
X_2 &= \frac{(s^2+1)sL+v}{s^2(s^2+2)} 
\end{align*}
Partial fraction expansion,
\begin{align*}
X_1 &= \frac{L/2}{s} +\frac{v/2}{s^2} +\frac{-sL/2+v/2}{s^2+2} \\
X_2 &= \frac{L/2}{s} +\frac{v/2}{s^2} +\frac{sL/2-v/2}{s^2+2}
\end{align*}
\begin{align*}
D &= X_2-X_1 \\
&=\frac{sL-v}{s^2+2}
\end{align*}
Inverse Laplace transform for $D$,
\begin{align*}
d(t) &= L \cos (t\sqrt{2}) -\frac{v}{\sqrt{2}}\sin(t\sqrt{2}) \\
&=\sqrt{L^2+\frac{v^2}{2}}\cos\bigg(t\sqrt{2}+\tan^{-1}\bigg(\frac{v}{L\sqrt{2}}\bigg)\bigg)
\end{align*}
Question
Why can $d(t)$ become negative? What does it mean?
 A: I haven't combed through your math, but I suspect that you made some mistakes along the way. For instance, in your first set of equations $\ddot{x}_1(t)=-(x_1-x_2)$ should actually be $\ddot{x}_1(t)=(x_2-x_1-L)$. You can check yourself on this fact because the force ought to be $0$ when $d=L$. Furthermore, you need to be careful about your minus signs because when the force is positive on mass-2 then it ought to be negative on mass-1 (remember Newton's Third Law?).
I'm going to give you some tips for working on this problem and others like it, but first, I'm going to give you a word of advice: use the Laplace Transform only as a last resort; it is rarely necessary and almost always cumbersome.
Here's the method for approaching this problem: instead of making more work for yourself by taking the Laplace Transform, make less work by recasting the problem to be in terms of the variable $d=(x_2-x_1)$ at the very beginning and then subtracting the two equations of motion from one another. This change of variables looks like this:
$$
\ddot x_1=((x_2-x_1)-L)\\
\ddot x_2=-((x_2-x_1)-L)\\
\ddot x_2-\ddot x_1=-2((x_2-x_1)-L)\\
\ddot d=-2(d-L)
$$
From here, if you make one more change of variables to $X=d-L$ the problem becomes almost trivial to solve. And once you've solved it you can change your variables back to be in terms of $d$. Then, by plugging in your initial conditions (written in terms of $d$, of course), you should have no problem getting the solution.
You'll find that $d$ might still sometimes be negative in this new solution if $v$ is sufficiently large. This is due to the artificiality of the problem: real springs don't perfectly obey Hooke's Law and when the masses get close enough they would actually run into each other, but our model here doesn't take any of that into account. For this reason, our model allows the masses to pass through each other. Thankfully, the only thing that a negative value of $d$ means is that mass-1 is to the right of mass-2 - all of the kinematical properties still behave correctly.
A: I don't think this is the correct answer to the problem. The correct answer is pretty straightforward and simple (it's a sine function times a constant). Check out Kleppner and Kolenkow (Intro to Mechanics, page 128) for the correct solution. Also, I've done this problem using the Lagrangian, but I've never seen Laplace Transforms being used for this problem before.
