Free abelian group, matrix representation. Let $n$ be a positive integer and let $A$ be a free abelian group and let $\{e_1,\dots,e_n\}$ be a basis of $A$. Let $B$ be a subgroup generated by $\{v_1,\dots,v_n\}$ and $M=(m_{ij})$ be a matrix over the integers such that $v_j=m_{1j}e_1+\dots+m_{nj}e_n$, $1\le j\le n$. (e.g, the columns are the $v_i$'s generating $B$.).
a. Prove $A/B$ is finite if and only if $\det M\ne 0$.
b. Assuming $A/B$ is finite, prove that $|A/B|=\det M$. 
I basically need help with the second question. 
I would like, though, to know if my proof for a is valid: 
proof: 
a. (first direction) Assume $A/B$ is finite. Then $B$ is not {e}, for if it is, $A/B$ is isomorphic to $A$, and if $A$ is infinite, that would be a contradiction. I will prove by induction on n. For n=1: $B$ is not {e}(e=identity), and therefore $de_1$ is a basis of $B$ for an integer $d$. Therefore $\det M\ne 0$. Suppose now that if $A/B$ is finite, then $\det M\ne 0$, for $n$. I will show it is correct for $n+1$. (Here's where I am not so sure as for how valid what I am doing  is.). By my assumption, for $n$, if $A/B$ is finite, then $\det M\ne 0$, and therefore, $v_1,\dots,v_n$, represented by $e_1,\dots,e_n$, are linearly independent. Looking at the case $n+1$, we have $v_1,\dots,v_n$ linearly independent and represented by $e_1,\dots,e_n$ and we have $v_{n+1}$ represented by $e_1,\dots,e_{n+1}$. If $\det M=0$, then $v_{n+1}$ must be a linear combination of $v_1,\dots,v_n$. That is, $me_{n+1}$ is not in $B$ for every integer $m$. Therefore, there is infinite number of elements of the form $me_{n+1}$ that will create a new coset each, making a contradiction to the finiteness of $A/B$. The other direction is not that different…
I would really appreciate your help. Thank you, and sorry for the poor English, not my mother language.
 A: By fixing an identification, we may assume that $A = \mathbb{Z}^n.$ We can find two $n \times n$ invertible matrix $Q, P$ over $\mathbb{Z}$ such that $QMP^{-1} =  diag(d_1, d_2, \cdots , d_r, 0, \cdots, 0), d_1|d_2| \cdots |d_r, r \leq n,$ with the property that there is a basis $y_1, y_2, \cdots , y_n$ such that $d_1y_1, d_2y_2, \cdots , d_ry_r$ is a basis of $B.$ So we change the basis of $A$ to $\{y_1, y_2, \cdots , y_n\}$ and we assume that $M$ is of the above mentioned form and $B$ is generated by $d_1y_1, d_2y_2, \cdots , d_ry_r.$ Now note that $detM \neq 0 \Leftrightarrow r=n \Leftrightarrow A/B$  $(\cong \mathbb{Z}/d_1 \oplus \cdots \oplus \mathbb{Z}/d_n)$ is finite. This also gives the second result.
EDIT: $det (QMP^{-1}) = det Q. det M. det P^{-1} = \pm det M \Rightarrow det M = 0 \Leftrightarrow det (QMP^{-1}) = 0.$ Above we have proved that $det (QMP^{-1}) \neq 0 \Leftrightarrow A/B$ is finite. So $det M \neq 0 \Leftrightarrow A/B$ is finite. Using Structure Theorem of Finitely Generated Abelian Groups we can assume $M$ is a diagonal matrix and we do everything on that assumption. Going from $M$ to $QMP^{-1}$ we are basically giving automorphisms of $\mathbb{Z}^n$ to change it's basis in a suitable form so that the matrix $M$ become a diagonal matrix.
The above procedure is not only true for free abelian groups of finite rank, it also true for any free modules of finite rank over a PID. In that case you need Structure Theorem of Finitely Generated Modules over PID.
