Potential energy of a mass-spring system

I'm having trouble with determining the potential energy of the mass-spring system depicted below. We assume that the extensions of all 3 springs are zero when $x_1=x_2=0$. The potential energy that I obtained is apparently incorrect. Here is what I've done:

$$U = \frac{1}{2}kx_1^2 + \frac{1}{2}kx_2^2 + \frac{1}{2}k(x_1+x_2)^2 = k(x_1^2+x_1x_2+x_2^2),$$ where I've considered each spring's potential energy separately. The mark scheme's version for $U$ is this:

$k(x_1^2-x_1x_2+x_2^2)$, so I suppose for them, the PE for the middle spring is $U_{mid} = \frac{1}{2}k(x_1-x_2)^2 = \frac{1}{2}k(x_2-x_1)^2$. So my guess is that they've assumed that $x_1$ is negative? Is this the source of the discrepancy?

• For the potential energy stored in middle spring consider the system of two masses connected by the spring of relaxed length $\ell$. Displace $m2$ by the right by $x_2$. If $m1$ was fixed to the wall you’d have a contribution $\sim kx_2^2$. But $m1$ is not constrained in this way so it moves to right as well through the connection and the new length of spring is $\ell+x_2-x_1$. – CAF Apr 7 '18 at 14:28
• You and @nicael are confusing two unrelated issues. One issue is the initial conditions imposed on the masses. You can set the vibrating system by initially shifting each of the masses either to the left or to the right. The second issue is your choice of postive x-axis direction. Selecting the same direction to both masses is usually the preferred choice. In that case, $\frac{1}{2}k(x_2-x_1)^2$ is correct. – npojo Apr 7 '18 at 19:25

Consider a slightly different diagram:

The extensions (displacement of end of a spring from non-stretched position) of the three springs are $x_1 \hat x, \, x_2 \hat x_2$ and $(x_2-x_1) \hat x$ where $x_1$ and $x_2$ are the components of the displacements in the $\hat x$ direction.
Note that components $x_1$ and $x_2$ can be either negative or positive.

This gives the total potential energy stored in the three springs as $\frac 12 kx_1^2 + \frac 12 kx_2^2+\frac 12 k (x_2-x_1)^2$

If $x_1 =x_2$ then there is no elastic potential energy stored in the middle spring as one would expect.

So my guess is that they've assumed that $x_1$ is negative?

If the displacement of the end of the left hand spring is as shown in your diagram then the extension of the middle spring is still $(x_2-x_1) \hat x$ but in this case the component $x_1$ will have a negative value so you will end up with $(x_2-(-|x_1|))= (x_2+|x_1|)$ as the extension of the middle spring.

• That's right indeed, but it doesn't appear to be the case simply because the picture clearly shows that $x_1$ and $x_2$ have opposite direction, or does it? – nicael Apr 7 '18 at 20:19
• @nicael Usually only one direction is defined as positive. In this example I have suggested that it is $\hat x$. – Farcher Apr 7 '18 at 21:00
• This is rather a long way of saying "Yes, you are correct." – sammy gerbil Apr 8 '18 at 3:42
• @sammygerbil So you are saying that the directions of the arrows in the diagram define the positive directions? – Farcher Apr 8 '18 at 3:48
• I am saying that Ruslan has already identified the source of the discrepancy. There is no reason why the directions in the diagram cannot define the +ve directions for $x_1, x_2$. But this convention is inconsistent with the answer given in the marking scheme. – sammy gerbil Apr 8 '18 at 4:33