In a short exact sequence of modules, the extremes are finitely presented. Why is the central module finitely presented? I am currently stuck in the following problem, which is an excercise of a lecture of module theory:

Problem. Let $R$ be a unital ring and $$(*)\quad 0\rightarrow M\overset{f}{\rightarrow}N\overset{g}{\rightarrow}P\rightarrow 0$$ be a short exact sequence of right $R$-modules. If $M$ and $P$ are finitely presented, then $N$ is finitely presented.

All I have so far is that by the exactness of $(*)$ and the following exact sequences
\begin{align}
&R^m\rightarrow R^n\rightarrow M\rightarrow 0\\
&R^k\rightarrow R^l\rightarrow P\rightarrow 0
\end{align}
it can be seen that $\ker g$ and $N/\ker g$ are both finitely presented. But I can hardly figure out what to do next. Does it follow from this fact that $N$ is finitely presented?
 A: Here I guess I worked out another solution. The conditions are equivalent to 
\begin{align}
\require{AMScd}
\begin{CD}
@. R^m @. \ @. R^l @.\\
@. @VVV @. \ @VVV @.\\
@. R^n @. \ @. R^k @.\\
@. @V{\alpha}VV  @. @VV{\gamma}V @.\\
0@>>> M@>>{f}> N@>>{g}> P@>>> 0\\
@. @VVV @. @VVV @.\\
@. 0 @. @. 0 @.
\end{CD}
\end{align}
Let $\iota\colon R^n\to R^n\oplus R^k$ and $\pi\colon R^n\oplus R^k\to R^k$ be respectively the natural embedding and the natural projection. By $R^k$ is free and thus projective, as the following diagram shows, 
\begin{align}
\require{AMScd}
\begin{CD}
@. R^k @.\\
@. @VV{\gamma}V @.\\
N @>>{g}> P @>>> 0
\end{CD}
\end{align}
$\gamma$ can be lifted to a homomorphism $\tilde\gamma\colon R^k\to N$, such that $g\circ\tilde\gamma=\gamma$. Set $\tilde\alpha=f\circ\alpha\colon R^n\to N$. Define a homomorphism $\beta\triangleq \tilde\alpha\oplus\tilde\gamma\colon R^n\oplus R^k\to N$ by $\beta(x, y)=\tilde\alpha(x)+\tilde\gamma(y)$. Then we have
\begin{align}
\require{AMScd}
\begin{CD}
@. R^m @. \ @. R^l @.\\
@. @VVV @. \ @VVV @.\\
0 @>>> R^n @>{\iota}>> R^n\oplus R^k @>{\pi}>> R^k @>>> 0\\
@. @V{\alpha}VV  @VV{\beta}V @VV{\gamma}V @.\\
0@>>> M@>>{f}> N@>>{g}> P@>>> 0\\
@. @VVV @. @VVV @.\\
@. 0 @. @. 0 @.
\end{CD}
\end{align}
This diagram is commutative. Indeed, for each $x\in R^n$, 
\begin{align}
\beta\circ\iota(x)=\beta(x,0)=\tilde\alpha(x)=f\circ\alpha(x);
\end{align}
for each $(x, y)\in R^n\oplus R^k$, 
\begin{align}
g\circ\beta(x, y)=&g(\tilde\alpha(x)+\tilde\gamma(y))=g(\tilde\alpha(x))+g(\tilde\gamma(y))\\
=&g\circ f\circ\alpha(x)+\gamma(y)=\gamma(y)\\
=&\gamma\circ\pi(x,y).
\end{align}
Then the snake lemma entails that
\begin{align}
\ker\alpha\to\ker\beta\to\ker\gamma\to 0\to\mathrm{coker}\beta\to 0
\end{align}
is exact. Then $\beta$ is surjective and hence $R^n\oplus R^k\overset{\beta}{\to} N\to 0$ is exact. The same argument applies to
\begin{align}
\require{AMScd}
\begin{CD}
@. R^m @>>>  R^m\oplus R^l @>>> R^l @>>> 0\\
@. @VVV @VVV @VVV @.\\
0@>>> \ker\alpha@>{\iota}>> \ker\beta@>{\pi}>> \ker\gamma@>>> 0\\
@. @VVV @. @VVV @.\\
@. 0 @. @. 0 @.
\end{CD}
\end{align}
and we can get that
\begin{align}
R^m\oplus R^l\to R^n\oplus R^k\to N\to 0
\end{align}
is exact, and therefore $N$ is finitely presented.
A: This is exercise 4.8(2) in Exercises in modules and rings by T.Y. Lam. We can prove it as follows:
First, observe that since $M, P$ are finitely generated, $N$ is also finitely generated: one can show that if $m_1,\ldots,m_n$ generate $M$ and $p_1,\ldots,p_k$ generate $P$, then $f(m_1),\ldots,f(m_n)$, $g^{-1}(p_1),\ldots, g^{-1}(p_k)$ generate $N$.
Therefore $N\cong R^n/X$ for some $n\in\mathbb{N}$ and some $R$-module $X$. The aim now is to prove that $X$ is finitely generated.
Since $M$ is injected in $N$, there is some $Y\leq R^n$ such that $M\cong Y/X$. Therefore $$P\cong N/M\cong (R^n/X)/(Y/X)\cong R^n/Y.$$
This implies that $Y$ is finitely generated:
We have the exact sequence
$$0\rightarrow Y\rightarrow R^n\rightarrow P\rightarrow 0,$$
but we know that $P$ is finitely presented, so we also have
$$0\rightarrow K\rightarrow R^k\rightarrow P\rightarrow 0$$
with $K$ finitely generated. Since both $R^n$ and $R^k$ are projective, by Schanuel's lemma we get $$R^n\oplus K\cong R^k\oplus Y$$
with $K$ finitely generated, so $Y$ is finitely generated as well.
Now we have an exact sequence for $M$
$$0\rightarrow X\rightarrow Y\overset{\alpha}{\rightarrow} M\rightarrow 0$$
in which $Y$ is finitely generated and $M$ finitely presented. This implies that $X$ is finitely generated:
Since $Y$ is finitely generated, we can consider the short exact sequence
$$0\rightarrow \ker(\alpha\beta)\rightarrow R^k\overset{\alpha\beta}{\rightarrow} M\rightarrow 0$$
where $R^k\overset{\beta}{\rightarrow} Y$. By the same Schanuel's argument as before (since $M$ is finitely presented), this implies $\ker(\alpha\beta)$ is finitely generated, so $\ker(\alpha)\cong X$ is also finitely generated, as $\beta$ is surjective: The map $\ker(\alpha\beta)\rightarrow\ker(\alpha)$ such that $y\mapsto\beta(y)$ is well defined ($\beta(y)\in\ker(\alpha\beta)$ because $\alpha\beta(y)=0$ as $y\in\ker(\alpha\beta)$) and is an epimorphism (if $x\in\ker(\alpha)$ then there exists $y\in R^k$ such that $\beta(y)=x$; then $\alpha\beta(y)=0$ and thus $y\in\ker(\alpha\beta)$). Lastly, an epimorphic image of a finitely generated module is finitely generated.
