This question is from an old comprehensive exam:
Let $R$ be a PID and let $F$ be a free module with basis $e_1, \ldots, e_n$. Fix $x_1, \ldots, x_n \in R$, not all zero, and consider the submodule $M$ spanned by $b := x_1e_1 + \ldots + x_n e_n$. Assume that $F = M \oplus N$ for some submodule $N$. Prove that the ideal $(x_1, \ldots, x_n)$ is equal to $R$.
My idea is: write $I = (a)$, $x_i = k_i a$ and consider the module $K$ generated by $k_1e_1 + \ldots + k_ne_n$; then $F = aK \oplus N$. I'd like to use $aK \leq K \leq F$ to conclude that $aK = K$, in which case $a \in R^\times$ is a unit so $(a) = R$. However, I'm not sure how to justify this.
Thanks to Rob and Anne in the comments:
Let $c := k_1 e_1 + \ldots + k_n e_n$. Since $F = M \oplus N$ and $M$ is spanned by $b$, we can write $c = rb + n$ for some $r \in R$ and $n \in N$.
Suppose $n \neq 0$; then $n \in K$ since $rb \in K$, so $an \in M = aK$. Since $N$ is free, $an \neq 0$ and $an \in M \cap N$, contradicting $F = M \oplus N$. Thus, $n = 0$ and $c = rb$.
Since $b = ac$, we have $c = (ra)c$. Since $M$ is free, we must have $1 = ra$ as $b, c \neq 0$. Thus, $a \in R^\times$ is a unit and $(a) = (x_1, \ldots, x_n) = R$.