I'm trying to understand the solution of the following problem.
Two masses $m_{1}$ and $m_{2}$ slide freely in a horizontal frictionless track and are connected by a spring whose force constant is $K$. Find the the frequency of oscilatory motion for this system.
In the solutions manual, it is considered that $x_{1}$ and $x_{2}$ are the coordinates of $m_{1}$ and $m_{2}$, respectively, and the length of the spring at equilibrium is $l$. Then, it is defined that, the equations of motion for each mass are:
$$ m_{1}\ddot x_{1} = -k(x_{1} - x_{2} + l), \\ m_{2}\ddot x_{2} = -k(x_{2} - x_{1} - l).$$
And, with some algebraic manipulations, we arrive at the answer.
My question is about the right hand side of these two equations. Why is the displacement in the restoring force equal to the difference between the positions plus the length of the spring in the first equation and minus on the second? What is the behavior of the system during the move? What changes in the analysis when I consider the frictional force? Could I consider that this motion has some relationship with the center of mass of the system?