What are the equations modelling a vertical spring system with two masses? Modeling a vertical spring system with one mass is a pretty common problem. I looked around online and found some horizontal spring systems with two masses, but no examples of a vertical one. 
I'm curious, how would you set up equations modeling a vertical spring system like this:
$$
----\\
\wedge \\
\vee \\
\wedge \\
\vee\\
(m_1)\\
\wedge\\
\vee\\
\wedge\\
\vee\\
(m_2)
$$
Where the first spring has constant $k_1$, and the second $k_2$. I'll let $y_1(t)$ be the position of the top mass away from its equilibrium, and $y_2(t)$ the position of the bottom mass away from its equilibrium. I choose down to be the positive direction.
For the bottom mass, there is an upward force of $k_2y_2$, and a downward gravitational force of $m_2g$. So one equation should be
$$
m_2y_2''=-k_2y_2+m_2g
$$
For the top mass, the first spring pulls up with force $-k_1y_1$ and a downward gravitational force of $m_1g$. I'm not sure how to account for the forces of the second spring and second mass acting of the first mass. Is the equation something like
$$
m_1y_1''=-k_1y_1+m_1g+\text{ something?}
$$
I'm just curious how you would correctly set up the equations for this system. Thanks.
 A: Since it seems you are not incorporating a damping term, I'll proceed under that assumption.
Let $k_i$ denote the spring constant for the spring above mass $m_i$, $i=1,2$. Then by Newton's Second Law $F=ma$ and Hooke's Law which says that the restorative force of the $y$ units beyond its equilibrium position, i.e. $F_\text{restorative}=-ky$, we get
\begin{align}
m_1y''_1&=\overbrace{-k_1y_1}^{\text{Hooke's Law from above}}\underbrace{-k_2(y_1-y_2)}_{\text{Hooke's Law from below}},\\
m_2y''_2&=\underbrace{-k_2(y_2-y_1)}_{\text{Hooke's Law from above}}
\end{align}
which is a linear coupled system in $y_1$ and $y_2$.
To see how Hooke's Law leads to these terms, first displace mass $m_1$ by $y_1$ units (taking "down" as the positive direction). Then Hooke's Law says spring 1 has a restoring force of $-k_1y_1$. Now pull mass $m_2$ down $y_2$ units. Since the total displacement of mass $m_2$ from its equilibrium position is $y_2-y_1$, this explains the Hooke's Law term $-k_2(y_2-y_1)$ in the second equation. Finally, to see where the second Hooke's Law term in the first equation comes from, just note that that will be the same force we just found for the second mass, $-k_2(y_2-y_1)$, but when it acts on the first mass, it will be in the opposite direction, so it will be $-k_2(y_1-y_2)$ which we can write as $+k_2(y_2-y_1)$ if you prefer.
A: For a damping and drive-free system;
Note that Hooke's Law states $F_s = -k\Delta y$, and since we take our initial position measurement at equilibrium, $F_s=-ky$.
Suppose that mass 2 is fixed at its equilibrium and mass 1 is free to oscillate. Summing the forces acting on mass 1 gives $\sum F_{1, free 1} = -k_1 y_1-k_2 y_1$, because both springs want to restore mass 1 to equilibrium.
Now have mass 1 fixed and mass 2 free to move. The total force on mass 1 is $\sum_{1, free 2} = -(-k_2 y_2)=k_2 y_2$, because the force on mass 1 acts opposite to the restoring force on mass 2.
By Newton's Second Law, $$\sum F_1 = -k_1 y_1-k_2 y_1 + k_2 y_2 = -k_1 y_1 -k_2(y_1 - y_2) = m_1 y_1''$$ where we can see Hooke's Law for each spring interacting with mass 1.
Similarly, suppose mass 2 is fixed at equilibrium and mass 1 is free to move, then $\sum F_{2, free 1} = -(-k_2 y_1) = k_2 y_1 $, because the force on mass 2 acts opposite to the restoring force on mass 1.
Then, when mass 1 is fixed at equilibrium and mass 2 is free to move, $\sum F_{2, free 2} = -k_2 y_2$, by Hooke's Law.
Applying Newtons Second Law, $$\sum F_2 =  -k_2 y_2 + k_2 y_1 = -k_2(y_2-y_1) = m_2 y_2''$$
So, our equations would be
$$ m_1 y_1'' = -k_1 y_1 -k_2(y_1 - y_2) $$
$$ m_2 y_2''= -k_2(y_2-y_1) $$
Put simply, the reason gravity is left out is that we can define a new equilibrium position where the force of gravity is balanced by the restoring force of the spring over some distance $d$ such that $-kd+mg=0$.
