I'm studying Eisenbud's Commutative Algebra with a View Toward Algebraic Geometry, and I'm not sure I'm following one of his proofs.
We have a ring $R$, an ideal $I$ of $R$, a module $N$, and a submodule $N'$ of $N$. We know that $N/N' \cong R/I$.
Why do the cokernels of $\phi$ and $\phi'$ coincide? I've come up with a diagram-chasing argument that I've written below (and I think it's a special case of the snake-lemma, but the book hasn't covered that yet), but that seems like a lot of work for something that is implied to be immediate. Is there a more obvious reason why the result is true?
I suppose it's possible that my proof is the one Eisenbud had in mind, but it seems unlikely. He doesn't include the commutative diagram until the cokernels have been established to be isomorphic, and later on in the proof, he does a full, equally long diagram-chase to prove something else, so it doesn't seem like he is expecting the reader to come up with these sorts of proofs themselves.
Here is my diagram-chasing argument:
Let $C '= N'/\varphi'(I)$ and $C = N/\varphi(R)$ be the two cokernels. Let $i : N' \to N$ be the inclusion map, and let $\pi : N \to C$ be the projection map. The map $\pi \circ i$ is $0$ on $\varphi'(I)$, so it induces a map $\alpha : C' \to C$.
First, we will show that $\alpha$ is injective. Suppose that $\alpha(c') = 0$, and let $n' \in N'$ be a representative for $c'$. Then, $\pi(i(n')) = 0$, so $i(n') = \varphi(r)$ for some $r \in R$. The map $N \to N/N'$ sends $\varphi(r)$ to $0$ by exactness, so since the induced map $R/I \to N/N'$ is injective, $r \in I$, so $n' \in \varphi'(I)$, so $x = 0$.
Now, we will show that $\alpha$ is surjective. Take any $c \in C$, and let $m \in N$ be a representative for $c$. The map $R/I \to N/N'$ is surjective, so there exists $s \in R$ such that the image of $s$ in $N/N'$ equals the image of $m$, meaning $m - \varphi(s) \in N'$. Let $m' = m - \varphi(s) \in N'$. Then, $$(\pi \circ i)(m') = \pi(m) - \pi(\varphi(s)) = c,$$ so $\alpha$ maps the image of $m'$ in $C'$ to $c$.

Your proof is essentially the argument Eisenbud has in mind here. Here's a perhaps simpler way of formulating it. Write $K$ for the image of $\varphi$. Since $N/N'\cong R/I$ is generated by the coset of $n$, $N$ is generated by $N'$ and $n$. That is, $N=N'+K$. Thus we have $N/K\cong N'/(N'\cap K)$. But $N'\cap K$ is just the image of $\varphi'$, since if $\varphi(r)\in N'$ then $r$ becomes $0$ in $N/N'\cong R/I$ and so $r\in I$. Thus $N/K\cong N'/\operatorname{im}(\varphi')$, as desired.