Why does the ideal $(a+bi)$ have index $a^2+b^2$ in $\mathbb{Z}[i]$? In the comments on the question Why does this module structure have $352512$ elements?, it is mentioned that the index of the ideal generated by $a+bi$ in $\mathbb{Z}[i]$ has order $a^2+b^2$. 
Is there a nice rigorous explanation of why this is so?
 A: If you know a bit of theory, there's a chain of equalities:

*

*The index of the ideal is equal to the number of elements in the quotient ring

*The number of elements in the quotient ring is equal to the norm (over $\mathbb{Q})$ of the ideal

*The norm of an ideal is equal to the (ideal generated by the) norm of a generator

*The norm on $\mathbb{Q}(i)$ over $\mathbb{Q}$ is given by $\mathcal{N}(x + \mathbb{i} y) = x^2 + y^2$.

A: $x+iy$ is part of the ideal generated by a+ib iff can be written as $(ac-bd)+i(cb+ad) = (a+ib)(c+id)$.
So 
$\begin{align} 
x&= ac-bd\\
y&= bc+ad 
\end{align}
$
Solving for $c$ and $d$ we find
$\begin{align} 

c&= (x+bd)/a\\
d&=(ay-bx)/(a^2 + b^2)
\end{align}$
Since $d$ needs to be an integer we have that
$a^2 + b^2 | ay-bx$
From Bézout's Identity we know that $ay-bx$ can be any integer if $a$ and $b$ are coprime, therefore we have $a^2 + b^2$ equivalence classes.
If $a$ and $b$ are not coprime (let $d$ be the GCD) we only have $(a^2 + b^2)/d$ equivalence classes.
I never used a math text editor so I'm sorry about the notation. I feel weird about not using the fact that $a|(x+bd)$ but the rest should be ok.
I would be glad if someone can explain me how to write math here. Thanks.
A: In Quotient ring of Gaussian integers it was shown that for $a,b$ coprime the quotient is actually isomorphic to $\mathbb Z / (a^2+b^2)$, but in general, it is still true that they have the same size.
If you look at the picture 
taken from the answer Quotient ring of Gaussian integers by quanta in the above-mentioned thread, you see that we want to count the lattice points in the square spanned by $a+bi$ and $-b+ai$.
As the points on the border have to be partially identified, it turns out we want to count interior points plus half the border points -1. (Since opposite sides of the square are identified, we want to count only half the border points, but we want to count only 1 of the 4 corners, so we have to subtract one.)
This gives exactly the area $\left(\sqrt{a^2+b^2}\right)^2=a^2+b^2$ of the square by Pick's theorem.
A: One have $(a+ib)\mathbb Z[i]= (a+ib)\mathbb Z \oplus (-b+ia)\mathbb Z$, so the ideal $(a+ib)$ is the free $\mathbb Z$-submodule of $\mathbb Z[i] =\mathbb Z \oplus i\mathbb Z$ generated by $a+ib$ and $-b+ia$. Some basic algebra theory tells you that the index of this submodule is $\det \begin{pmatrix} a&-b\\b&a \end{pmatrix} = a^2+b^2$.
Edit : See here for the proof :
Why is the determinant equal to the index?
