To help us out let’s first take a quick look at a situation in which both of the masses have been moved. This is shown below.

Before proceeding let’s note that this is only a representation of a typical case, but most definitely not all possible cases.

In this case we’re assuming that both \({x_1}\) and \({x_2}\) are positive and that \({x_2} - {x_1} < 0\), or in other words, both masses have been moved to the right of their respective equilibrium points and that \({m_1}\) has been moved farther than \({m_2}\). So, under these assumptions on \({x_1}\) and \({x_2}\) we know that the spring on the left (with spring constant \({k_1}\)) has been stretched past it’s natural length while the middle spring (spring constant \({k_2}\)) and the right spring (spring constant \({k_3}\)) are both under compression.

Also, we’ve shown the external forces, \({F_1}\left( t \right)\) and \({F_2}\left( t \right)\), as present and acting in the positive direction. They do not, in practice, need to be present in every situation in which case we will assume that \({F_1}\left( t \right) = 0\) and/or \({F_2}\left( t \right) = 0\). Likewise, if the forces are in fact acting in the negative direction we will then assume that \({F_1}\left( t \right) < 0\) and/or \({F_2}\left( t \right) < 0\).

Before proceeding we need to talk a little bit about how the middle spring will behave as the masses move. Here are all the possibilities that we can have and the affect each will have on \({x_2} - {x_1}\). Note that in each case the amount of compression/stretch in the spring is given by \(\left| {{x_2} - {x_1}} \right|\) although we won’t be using the absolute value bars when we set up the differential equations.

- If both mass move the same amount in the same direction then the middle spring will not have changed length and we’ll have \({x_2} - {x_1} = 0\).

- If both masses move in the positive direction then the sign of \({x_2} - {x_1}\) will tell us which has moved more. If \({m_1}\) moves more than \({m_2}\) then the spring will be in compression and \({x_2} - {x_1} < 0\). Likewise, if \({m_2}\) moves more than \({m_1}\) then the spring will have been stretched and \({x_2} - {x_1} > 0\).

- If both masses move in the negative direction we’ll have pretty much the opposite behavior as #2. If \({m_1}\) moves more than \({m_2}\) then the spring will have been stretched and \({x_2} - {x_1} > 0\). Likewise, if \({m_2}\) moves more than \({m_1}\) then the spring will be in compression and \({x_2} - {x_1} < 0\).

- If \({m_1}\) moves in the positive direction and \({m_2}\) moves in the negative direction then the spring will be in compression and \({x_2} - {x_1} < 0\).

- Finally, if \({m_1}\) moves in the negative direction and \({m_2}\) moves in the positive direction then the spring will have been stretched and \({x_2} - {x_1} > 0\).

Now, we’ll use the figure above to help us develop the differential equations (the figure corresponds to case 2 above…) and then make sure that they will also hold for the other cases as well.

Let’s start off by getting the differential equation for the forces acting on \({m_1}\). Here is a quick sketch of the forces acting on \({m_1}\) for the figure above.

In this case \({x_1} > 0\) and so the first spring has been stretched and so will exert a negative (*i.e.* to the left) force on the mass. The force from the first spring is then\( - {k_1}{x_1}\) and the “-” is needed because the force is negative but both \({k_1}\) and \({x_1}\) are positive.

Next, because we’re assuming that \({m_1}\) has moved more than \({m_2}\) and both have moved in the positive direction we also know that \({x_2} - {x_1} < 0\). Because \({m_1}\) has moved more than \({m_2}\) we know that the second spring will be under compression and so the force should be acting in the negative direction on \({m_1}\) and so the force will be \({k_2}\left( {{x_2} - {x_1}} \right)\). Note that because \({k_2}\) is positive and \({x_2} - {x_1}\) is negative this force will have the correct sign (*i.e.* negative).

The differential equation for \({m_1}\) is then,

\[{m_1}{x''_1} = - \,{k_1}{x_1} + {k_2}\left( {{x_2} - {x_1}} \right) + {F_1}\left( t \right)\]

Note that this will also hold for all the other cases. If \({m_1}\) has been moved in the negative direction the force form the spring on the right that acts on the mass will be positive and \( - {k_1}{x_1}\) will be a positive quantity in this case. Next, if the middle mass has been stretched (*i.e.* \({x_2} - {x_1} > 0\)) then the force from this spring on \({m_1}\) will be in the positive direction and \({k_2}\left( {{x_2} - {x_1}} \right)\) will be a positive quantity in this case. Therefore, this differential equation holds for all cases not just the one we illustrated at the start of this problem.

Let’s now write down the differential equation for all the forces that are acting on \({m_2}\). Here is a sketch of the forces acting on this mass for the situation sketched out in the figure above.

In this case \({x_2}\) is positive and so the spring on the right is under compression and will exert a negative force on \({m_2}\) and so this force should be \( - {k_3}{x_2}\), where the “-” is required because both \({k_3}\) and \({x_2}\) are positive. Also, the middle spring is still under compression but the force that it exerts on this mass is now a positive force, unlike in the case of \({m_1}\), and so is given by \( - {k_2}\left( {{x_2} - {x_1}} \right)\). The “-” on this force is required because \({x_2} - {x_1}\) is negative and the force must be positive.

The differential equation for \({m_2}\) is then,

\[{m_2}{x''_2} = - \,{k_3}{x_2} - {k_2}\left( {{x_2} - {x_1}} \right) + {F_2}\left( t \right)\]

We’ll leave it to you to verify that this differential equation does in fact hold for all the other cases.

Putting all of this together and doing a little rewriting will then give the following system of differential equations for this situation.

\[\begin{align*}{m_1}{{x''}_1} & = - \left( {{k_1} + \,{k_2}} \right){x_1} + {k_2}{x_2} + {F_1}\left( t \right)\\ {m_2}{{x''}_2} & = {k_2}{x_1} - \left( {{k_2} + \,{k_3}} \right){x_2} + {F_2}\left( t \right)\end{align*}\]

This is a system to two linear second order differential equations that may or may not be nonhomogeneous depending whether there are any external forces, \({F_1}\left( t \right)\) and \({F_2}\left( t \right)\), acting on the masses.