Integral Dependence & Finitely Generated Modules How to prove $(3)\Rightarrow(1)$ of this theorem:

Let $A\subseteq B$ be commutative rings. The following are equivalent:
  $(1)~~x\in B$ is integral over $A$; 
  $(2)~A[x]$ is a finitely generated $A$-module; 
  $(3)~A[x]$ is contained by a subring $C$ of $B$ such that $C$ is a finitely generated $A$-module.

In my notes it says:

$(3)\Rightarrow(1)$: Use the fact that if $M$ is a finitely generated $R$-module, $\phi:M\to M$ an $R$-module homomorphism, $\mathfrak a\lhd R$ and $\phi(M)\subseteq \mathfrak a M$, then $\phi$ satisfies an equation $\phi^n+a_{n-1}\phi^{n-1}+\dots+a_0=0$ for some $a_i\in \mathfrak a$.

But I don't see which elements from the theorem I should use as $M,\ \mathfrak a$ and $\phi$.
 A: Try $R = \mathfrak{a} = A$, $M = C$, and $\phi = $ multiplication by $x$. Note that there's still something to prove after applying the fact: why does the endomorphism $\phi$ satisfying $X^n + a_{n - 1}X^{n - 1} + \cdots + a_0 = 0$ imply the same for $x$?
A: Directly: we're given that
$$A[x]\subset C=\sum_{k=1}^nc_iA\;,\;\;c_i\in C\implies\;\exists\,a_{ij}\in A\;,\,\,1\le i,j\le n\;,\;\;s.t.\;\forall\,j=1,2...,n\;:$$
$$xc_j=\sum_{k=1}^nc_ka_{kj}\iff \sum_{k=1}^nc_k\left(x\delta_{kj}-a_{kj}\right)=0$$
with $\,\delta_{kj}=$ the  Kronecker delta. Denote the matrix $\,B:=\left(x\delta_{kj}-a_{kj}\right)\,$ , so that if $\,B'\,$ is this matrix's classic adjoint, then
$$\sum_{k=1}^nc_kBB'=B'0=0$$
But then $\,BB'=\det B\cdot I_n\,$  annihilates every generator of $\,C\,$ , from which it follows that it is the zero $\,A$-endomorphism on C. Develop this determinant and you get a monic equation in $\,A\,$ of which $\,x\,$ is a zero, i.e.: $\,x\,$ is integral over $\,A\,$ .
All the above is, of course, in several classic books, like Atiyah-Macdonald's...
A: $\textbf{Notations:}$ 
if $A$ is a ring and $M$ an $A$-module, we consider the ring $Hom_A(M)$ of $A$-endomorphism of $M$ and an element $\phi\in
Hom_A(M)$. Let
$A[\phi]=\{a_0\phi^0+a_1\phi^1+\ldots+a_n\phi^n:
n\in\mathbb{N},a_i\in A\}$, where $\phi^0=id_M$ and
$\phi^j=\underbrace{\phi\circ\phi\ldots\circ\phi}_{j
\textrm{times}}.$
It is evident that $A[\phi]$ is a subring of
$Hom_A(M)$, which we'll denote by $B$.
Then $M$ has an obvious $B$-module structure, given by
$\phi\bullet m=\phi(m)$ for every $m\in M$
$\textbf{(1)}$ Let $B$ be a ring and $H\in M_n(B)$ an $n\times n$ matrix with $B$-coefficients. Denote with $H^{ad}$ the classical adjoint matrix of $H$, then
$$H\cdot H^{ad}=H^{ad}\cdot H=\det(H)\cdot I_n$$
Now let $M$ be a $B$-module and $\psi_H\in Hom_B(M^n)$ the linear map associated to $H$. Let
$(\alpha_1,\ldots,\alpha_n)\in Ker(\psi_H)$. Then we have
$$H\cdot\left(\begin{array}{c}\alpha_1\\ \vdots \\
\alpha_n\end{array}\right)=\left(\begin{array}{c}0\\ \vdots \\
0\end{array}\right)$$
Multiplying both sides by $H^{ad}$ gives
$$\det(H)\left(\begin{array}{c}\alpha_1\\ \vdots \\
\alpha_n\end{array}\right)=\left(\begin{array}{c} 0\\ \vdots \\
0\end{array}\right)$$
or equivalently
$$\det(H)\cdot \alpha_i=0$$ for every $i=1,\ldots,n$
If in particular we chose $B:=A[\phi]$, then $\det(H)$ is in $B$, say $\det(H)=D(\phi)$, for some polynomial $D$. Summarzing, if $(\alpha_1,\ldots,\alpha_n)\in M^n$ satisfies the following property
$$H\cdot\left(\begin{array}{c}\alpha_1\\ \vdots \\
\alpha_n\end{array}\right)=\left(\begin{array}{c}0\\ \vdots \\
0\end{array}\right)$$
then $\det(H)=D(\phi)$ satisfies this one: $D(\phi)\cdot\alpha_i=D(\phi)(\alpha_i)=0$ for every $i=1,\ldots,n$.
$\textbf{(2)}$ Let $M$ be a finitely generated  $A$-module, let $\{\alpha_1,\ldots,\alpha_n\}$ a set of generators for $M$ over $A$. Let $\phi\in Hom_A(M)$. Set $B=A[\phi]$ and let $H\in M_n(B)$ be such that
$$H\cdot\left(\begin{array}{c}\alpha_1\\ \vdots \\
\alpha_n\end{array}\right)=\left(\begin{array}{c}0\\ \vdots \\
0\end{array}\right)$$
Thanks to point (1) we get $D(\phi)(\alpha_i)=0$ for every $i$. But now $\alpha_i$'s generate $M$ over $A$ hence we can conclude that 
$$D(\phi)=0_{Hom_A(M)}$$
$\textbf{(3)}$
Let $A$ be a ring, $M$ a finitely generated $A$ module and $\phi\in
Hom_A(M)$. Let $\mathfrak{a}\subseteq A$ an ideal, with $\phi(M)\subseteq
\mathfrak{a}M$. Then there exists a relation of the form:
$$\phi^n+a_1\phi^{n-1}+\ldots +a_n=0_{Hom_A(M)}$
$$
where $a_i$'s are elements of $\mathfrak{a}$. 
$\textbf{proof:}$
let $\{\alpha_1,\ldots,\alpha_n\}$ a set of generators of $M$
su $A$. Apply $\phi$ to generators and get
$$\phi(\alpha_i)=\displaystyle\sum_{j=1}^na_{ij}\alpha_j$$
From  $\phi(M)\subseteq \mathfrak{a}M$ follows that $a_{ij}\in \mathfrak{a}$ for every
$i,j=1,\ldots,n$. We can write
$$\phi(\alpha_i)=\displaystyle\sum_{j=1}^n\delta_{ij}\phi(\alpha_j)$$
and with these notation the previous relation becomes
$$\displaystyle\sum_{j=1}^n(\delta_{ij}\phi-a_{ij})\alpha_j=0$$
or, in matrix form
$$\left(\begin{array}{cccc}\phi-a_{11}&-a_{12}&\ldots & -a_{1n}\\
-a_{21}& \phi-a_{22}& \ldots & -a_{2n}\\ \vdots & \vdots
&&\vdots\\ -a_{n1}& -a_{n2}& \ldots & \phi
-a_{nn}\end{array}\right)\left(\begin{array}{c}\alpha_1\\ \vdots
\\ \alpha_n\end{array}\right)=\left(\begin{array}{c} 0\\ \vdots \\
0\end{array}\right)$$
We are under hypothesis of point 2),where $H$ is the $n\times n$ matrix in left-hand side, so that we can conclude that
$$D(\phi)=\det(H)=0$$
But this is precisely what we wanted, since $D(\phi)=\phi^n+a_1\phi^{n-1}+\ldots+a_n=0$ and $a_i$'s are elements of $\mathfrak{a}$, because they are product of $a_{ij}$'s that lie in $\mathfrak{a}$.
