If $N\cap rM=rN$ for all $r\in R$, then is $M=N\oplus K$ for some $K$? 
Suppose $M$ is a finitely generated free module over a principal ideal domain $R$, and $N$ a submodule. Why does the condition $N\cap rM=rN$ for all $r\in R$ implies that $M=N\oplus K$ for some $K$?

I was trying to take a stab at like this. In the proof of the invariant factor form of the structure theorem, we find that there is a basis $y_1,\dots,y_n$ of $M$ so that $a_1y_1,\dots,a_my_m$ is a basis of $N$ and $a_1\mid a_2\mid\cdots\mid a_m$. 
By the assumption, $a_iy_i\in N\cap a_iM=a_iN$, so there exists $v_i\in N$ such that $a_iy_i=a_iv_i$. Then the set $\{v_1,\dots,v_m,y_{m+1},\dots,y_n\}$ can be show to be linearly independent, by multiplying through $\prod_i a_i$ any linear combination equaling $0$. But I don't think this set is a basis, because it seems doubtful that it would span if the $a_i$ are not units.
Is there a correct way to see the conclusion?
 A: Here's an abstract way to see this: the condition $N \cap rM = rN$ for every $r \in R$ says exactly that the multiplication map $M/N \xrightarrow{r} M/N$, sending $\overline{x} \mapsto r\overline{x}$, is injective for all $r \ne 0$ (*). This means that $M/N$ is a torsionfree $R$-module, but since $R$ is a PID and $M/N$ is finitely generated, $M/N$ is projective. Thus the sequence $0 \to N \to M \to M/N \to 0$ is split exact, which is exactly your desired conclusion.
Proof of (*): Let $r \ne 0$. If $r\overline{x} = \overline{0}$, then $rx \in N \cap rM = rN$, so $rx = ry$ for some $y \in N$. Since $M$ is free, hence torsionfree, $r$ is a nonzerodivisor on $M$, so $r(x-y) = 0 \implies x - y = 0$, so $x \in N$.
A: One can in fact show the $a_i$s are units. Let $\pi_i$ be the projection onto the $i$th factor of $M=R^n$. Let $I$ be the submodule with $a_iR$ in the $i$th factor and $0$s in other coordinates. Then $I\subseteq a_iM,N$ and so $a_iR=\pi_i(I)\subseteq \pi_i(a_iM\cap N)\subseteq \pi_i(N)=a_iR$ hence $\pi_i(\color{Blue}{a_iM\cap N})=\color{Green}{a_iR}$ yet $\pi_i(\color{Blue}{a_iN})=\color{Green}{a_i^2R}$.
