$X$ is a basis for free abelian group $A_{n}$ if and only if $\det (M) = \pm 1$ This question is related to another problem I asked a question about here. In fact, it is part (b) of a problem whose part (a) was

Let $X = \{ x_{1}, x_{2}, \dots, x_{n}\}$ be a set of elements of the free abelian group $A_{n}$.  Let $M$ be the $n\times n$ matrix of coordinates of elements $x_{i}$ in terms of the basis $B=\{b_{1},b_{2},\dots, b_{n}\}$ (where $x_{i}=r_{i1}b_{1}+r_{i2}b_{2}+\cdots + r_{in}b_{n}$, and the coordinates $r_{ij}$ define the matrix $M=(r_{ij})$).
Assume $M^{\prime}$ is a matrix obtained from $M$ by a sequence of elementary transformations.
Prove that $M^{\prime}=ZMY$, where $Z$, $Y$ are some matrices in $GL(n, \mathbb{Z})$.

For the part of the problem I'm asking about now, I need to show that $X$ is a basis for $A_{n}$ if and only if $\det (M) = \pm 1$.
For the direction $(\Longleftarrow)$, I was given the hint: "How is $\det(M)$ changed under transformations of $M$?" Using this hint, I was able to get to the following point: 

Suppose $\det M = \pm 1$. By Part (a), if $M^{\prime}$ is a matrix
  obtained by a sequence of elementary transformations on $M$, then
  $M^{\prime}=ZMY$, where $Z$, $Y$ $\in GL(n,\mathbb{Z})$. Since $Z, Y
 \in GL(n, \mathbb{Z})$, $\det(Z) = \pm 1$ and $\det(Y) = \pm 1$. From
  linear algebra, we know that the determinant of a product of matrices
  is equal to the product of the determinants, so $\det(Z) \cdot \det
 (M) \cdot \det(Y) = (\pm 1) (\pm 1) (\pm 1) = \pm 1 =
\det(M^{\prime})$.

This was as far as I was able to get though, because I am having trouble understanding how to reconcile this with $X$ being a basis for $A_{n}$.
For the $(\Longrightarrow)$ direction, I was able to get even less, primarily because of the fact that I don't understand how $X$ being a basis for $A_{n}$ has anything to do with  what the determinant of $M$ is.

I started by saying that if $X$ is a basis for $A_{n}$, then $\forall
a_{i} \in A_{n}$, $\exists c_{i1}, c_{i2}, \cdots , c_{in} \in
 \mathbb{Z}$ such that $a_{i}=c_{i1}x_{1} + c_{i2}x_{2}+\cdots +
 c_{in}x_{n}$, where the $c_{ij}$ are the entries in the matrix $M$.
  And wasn't sure where to go from there.

Could someone please tell me where to go from where I've stopped (in both directions)? I'm very much stuck and this point. (And be prepared to be patient and answer lots of follow-up questions!)
Thank you! :)
 A: In the following $X = \{ x_{1}, x_{2}, \dots, x_{n}\}$.
Write
$$
[X]
=
\begin{bmatrix}x_{1}\\x_{2}\\ \vdots\\x_{n}\end{bmatrix}
$$
and similarly for $[B]$.
Then you have
$$
[X] = M [B].
$$
Now $\det(M) = \pm 1$ iff $M$ is invertible, i.e., it has an inverse which is itself an integer matrix. Thus if $\det(M) = \pm1$ you have
$$
[B] = M^{-1} [X].
$$
Now since $B$ is a basis, given any $v \in A_{n}$ there is a unique row vector $c$ such that $v = c [B]$. If $\det(M) = \pm 1$ we have 
$$
v = c [B] = (c M^{-1}) [X],
$$
so $v$ can be written as a linear combination of the elements of $X$. This is unique, since if $v = d [X]$ for some row vector $d$, then
$$
v = d [X] = d M [B],
$$
so $d M$ is uniquely determined, as $B$ is a basis, and thus so is $d = (d M) M^{-1}$. Therefore $X$ is a basis of $A_{n}$.
Conversely, if $X$ is a basis, every element of $B$ can be written as a linear combination of the elements of $X$, so there is a matrix $N$ such that $[B] = N [X] = N M [B]$. Since $B$ is a basis, we have that $N M = I$, the $n \times n$ identity matrix, and taking determinants ones sees that $\det(M) = \pm 1$.
