$d(h) = \gcd(a_1, \cdots, a_n)$ does not depend on a chosen basis for a finitely generated abelian group. Let $H$ be a subgroup of a finitely generated torsion free abelian group $G$.  Let $H$ be non-trivial.  Let $y_1, \dots, y_n$ be a basis of $G$.  For any $h = \sum a_i y_i \in H$ set $d(h) = \gcd(a_1, \dots, a_n)$.  This does not depend on the chosen basis.
How do I show that the change of basis matrix $P$ has determinant $\pm 1$?  Since that is used in the proof in Cohen H. Number Theory vol 1.
 A: You can avoid matrices altogether by finding a basis-independent definition.
Consider the set $M$ of all homomorphisms $G\to \mathbb Z$. Then define $D(h)$ for  $h\neq 0$ as:
$$D(h)=\min_{\{\phi\in M\mid \phi(h)>0\}} \phi(h)$$
Define $D(0)=0$.
Now if $h=a_1y_1+\cdots + a_ny_n$, then we see that $d(h)\mid D(h)$, since any common divisor of the $a_i$ must be a divisor of $\phi(h)=\sum a_i\phi(y_i).$
On the other hand, we can find $u_1,\dots,u_n\in\mathbb Z$ so that $a_1u_1+\cdots+a_nu_n=\gcd(a_1,\dots,a_n)=d(h).$ Then we can define $\phi\in M$ as $\phi(y_i)=u_i.$ So we have $\phi(h)=d(h)$, which then means that $D(h)\leq d(h).$
So we get that $D(h)=d(h)$ when $h\neq 0$ and $D(0)=0=d(0).$
But $D(h)$ is defined independent of the basis, so $d(h)$ is independent of the basis.

This all requires that a finitely generated torsion-free abelian group is a free abelian group (which is true, but may require proof.) (Free abelian lets you define the $\phi$ based on the $u_i$.)
This theorem and proof is true for any free abelian group, including infinitely-generated free abelian groups.
A: Assume that $P$ is an integer change of basis matrix.  Then $P x = y$, where $x, y$ are two basis vectors.  Let $x = Qy$.  Then $PQ y = y \implies (PQ - I) y = 0$.  But by a previous lemma, there are no nontrivial solutions $(a_i)$ for $\sum_{i=1}^n a_i y_i = 0$, thus $PQ - I = 0$.
Since $\det : M_n(\Bbb{Z}) \to \Bbb{Z}$ is multiplicative we have $\det(P)\det(Q) = 1$, which gives the result.
