TITLE: Explain why the determinant of $A$ is the index of the subring?
QUESTION [5 upvotes]: Let $a$ be an algebraic number, whose minimal polynomial has integral coefficients. Let $K = \Bbb Q(a)$ be an algebraic number field. Let $\mathcal O_K$ be the ring of integers in this algebraic number field. Fix an basis for $\mathcal O_K$ and $\Bbb Z[a]$. Let $A$ be the matrix whose column vectors express the basis elements of $\Bbb Z[a]$ as a $Z$-linear combination of the basis for $\mathcal O_K$. Then
$\det(A) = [\mathcal O_K : \Bbb Z[a]]$
I have no idea why this is the case. Can someone explain this to me?

REPLY [5 votes]: Expanding the comments to an answer.
As Rene pointed out this fact is a special case of a general result. Assume that $N\subseteq M$ are free abelian groups of the same rank $n$. Let $\mathcal{B}=\{x_1,x_2,\ldots,x_n\}$ be a basis of $M$,
and $\mathcal{C}=\{y_1,y_2,\ldots,y_n\}$ be a basis of $N$. As $N\subset M$ we have that 
$$
y_i=\sum_{j=1}^na_{ij}x_j
$$
for some integer matrix $A=(a_{ij})$. Everything follows from finding the Smith normal form of $A$. What that says is that there exists integer matrices $P$ and $Q$ such that
their determinants are $\pm1$ and
$$
PAQ=\left(\begin{array}{ccccc}d_1&0&0&\cdots&0\\
0&d_2&0&\cdots&0\\
0&0&d_3&\cdots&0\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
0&\cdots&0&0&d_n
\end{array}\right)
$$
for some positive integers $d_i, i=1,2,\ldots,n$.
Furthermore, here $d_{i+1}\mid d_i$ for all $i$.
What this means is that if we replace $\mathcal{B}$ with $\mathcal{B}'=Q^{-1}\mathcal{B}$,
and $\mathcal{C}$ with $\mathcal{C}'=P\mathcal{C}$, the resulting bases
$\mathcal{B}'=\{x_1',x_2,\ldots,x_n'\}$ and $\mathcal{C}'=\{y_1',y_2',\ldots,y_n'\}$ are stacked, IOW $y_i'=d_ix_i'$ for all $i$.
This implies immediately that
$$
M/N\cong \Bbb{Z}_{d_1}\oplus\Bbb{Z}_{d_2}\oplus\cdots\oplus\Bbb{Z}_{d_n}.
$$
Note that as $\det P=\pm1$ and $\det Q=\pm1$, it follows that
$$
|\det(A)|=d_1d_2\cdots d_n.
$$
Your claim follows from this.