Solution (source code)

= Solution

For each $s\in S\setminus T$, maximality implies a nontrivial relation
$$
a_s s+\sum_{t\in T}b_{s,t}t=0.
$$
Here $a_s\ne0$, since otherwise this would contradict the <linear independence in a module> of $T$. Thus $a_s s\in N$. Take $r=\prod_{s\in S\setminus T}a_s$, with empty product equal to one. Because $R$ is an <integral domain>, $r\ne0$. Every $s\in S\setminus T$ satisfies $rs\in N$, and this is also true for $s\in T$. Expressing any element of the <finitely generated module> as an $R$-linear combination of $S$ now gives \b[$rM\subseteq N$]. This is <clearing denominators relative to an independent module subset>; it does not require $R$ to be a field.