# Index of Principal Ideal in a Subring of $\mathbb{Q}(\sqrt{-3})$

Let $K=\mathbb{Q}(\sqrt{-3})$ and let $\mathcal{O}_K$ denote the ring of integers of $K$. If $\mathcal{O} = \{a+ b3\sqrt{-3}| a,b\in \mathbb{Z} \}$ (i.e., $\mathcal{O}$ is the order of conductor 3 in $\mathcal{O}_K$), then what is the index of the principal ideal $\langle 3\sqrt{-3}\rangle$ in $\mathcal{O}$?

How can I generalize such a method for principal ideal in other orders or quadratic fields?

The index of a principal ideal $\left<\alpha\right>$ in the ring of integers of a number field $K$ is $|N(\alpha)|$, the absolute value of the norm of $\alpha$. The same is true for any order. In your example the index is $N(3\sqrt{-3})=27$.
To see this, note that any order is a free module over $\Bbb Z$ of rank $n=|K:\Bbb Q|$. The map $\phi:x\mapsto\alpha x$ has determinant $N(\alpha)$ considering $\cal O$ as a free $\Bbb Z$-module, so the image of $\phi$ in $\cal O$ has index $|N(\alpha)|$.