Suppose that:
$0 \rightarrow M_{1} \rightarrow M \rightarrow M_{2} \rightarrow 0$
Is an exact sequence of $R$-modules (for $R$ commutative integral domain). Show that $\mathrm{rk}(M) = \mathrm{rk}(M_{1})+\mathrm{rk}(M_{2})$
I have shown the inequality $\mathrm{rk}(M) \geq \mathrm{rk}(M_{1})+\mathrm{rk}(M_{2})$, however for the opposite direction I'm lost. I tried to take $N$ as a linear independent subset and tried to decompose it into $N_{1}$ (the elements in $\mathrm{Ker}(g)$) and $N_{2}$ (the elements not in $\mathrm{Ker}(g)$), but I haven't got far, since $N_{1}$ gives us a linearly independent set in $M_{1}$, however $N_{2}$ can give us a linearly dependent set in $M_{2}$.
We define $\mathrm{rk}(M)$ in this case as the supremum over all cardinalities of the linearly independent subsets of $M$ (where the only finite linear combination equaling $0$ implies trivial coefficients for $r \in R$).
Would this be the proper way to show the result? I think I'm missing something important.
I am aware of the fact, that passing to the quotient field by localization or tensoring gives us an easy proof, but the OP asked for something more elementary.
First of all some notations: Denote the map $M \to M_2$ by $f$ and identify $M_1$ as the kernel of $f$, i.e. view $M_1$ as a subset of $M$.
Here is an elementary proof for the inequality
$$\operatorname{rk} M \leq \operatorname{rk} M_1 + \operatorname{rk} M_2.$$
Take $R$-linear independent subset $N \subset M$. Let $X \subset N$ be maximal with respect to the property that $f(X)$ is linear independent in $M_2$.
Now let $m \in N \setminus X$. The set $f(\{m\} \cup X)$ is linear dependent, hence we have some $r_m, \lambda_{m,x} \in R$ such that
$$0=r_mf(m) + \sum_{x \in X} \lambda_{m,x}f(x) = f\left(r_mm+\sum_{x \in X} \lambda_{m,x}x \right),$$
hence $r_mm+\sum_{x \in X} \lambda_{m,x}x \in M_1$.
Note that we have $r_m \neq 0$, since $f(X)$ is linear independent.
Let us proof that the elements $(r_mm+\sum_{x \in X} \lambda_{m,x}x)_{m \in N \setminus X}$ are linear indepedendent:
Let $\mu_m \in R$ such that
$$\sum_{m \in N \setminus X } \mu_m(r_mm+\sum_{x \in X} \lambda_{m,x}x) = 0$$
We rearrange this sum and get:
$$0=\sum_{m \in N \setminus X} \mu_mr_mm + \sum_{x \in X} \sum_{m \in N \setminus X} \mu_m\lambda_{m,x}x$$
The linear independence of $N$ yields (in particular) $\mu_mr_m=0$, hence $\mu_m=0$, since $r_m \neq 0$ and $R$ is an integral domain. This shows that the elements are indeed linear independent.
All in all we have shown:
We can split $N$ into a disjoint union $N = (N \setminus X) \cup X$, such that the elements of $N \setminus X$ are linear indepedenent in $M_1$ and the elements of $X$ are linear independent after passing to $M_2$. Thus we are done.
To the other inequality
$$\operatorname{rk} M \geq \operatorname{rk} M_1 + \operatorname{rk} M_2.$$
You have already shown this, so I only give a sketch:
Take a linear indepedent set $N_1 \subset M_1$ and another $N_2 \subset M_2$. View $N_1$ as set in $M$ in take arbitrary inverse images of the elements in $N_2$ to form a set $f^*(N_2)$ (which is in bijection with $N_2$). Then $N_1 \cup f^*(N_2)$ is a linear independent family in $M$, which proves the inequality. Note that this works over any commutative ring with unity, we can allow zero-divisors for this. (But we need the integral domain property for the other inequality as seen above)