TITLE: "Orthogonal complement" in $\mathbb{Z}_q^n$
QUESTION [5 upvotes]: Let $W$ be the finite $\mathbb{Z}$-module obtained from $\mathbb{Z}_q^n$ with addition componentwise where $\mathbb{Z}_q$ is the integers mod $q$. Let $V$ be a submodule of $W$. Let $V^{\perp} = \{w \in W : \forall v \in V \quad w \cdot v = 0 \}$ where $w\cdot v = w_1v_1 + \ldots + w_nv_n$. Is it true that ${(V^{\perp})}^{\perp} = V$ for all $q \geq 2$?
According to Wikipedia, this holds for finite dimensional inner product space, but I wish to know whether it holds in $\mathbb{Z}_q^n$ where $\cdot$ isn't an inner product.

REPLY [12 votes]: Yeah, it's true.  Since $\mathbb{Z}/q$ is a principal ideal ring, there is an extension of the Euclidean algorithm to matrices that puts any matrix in Smith normal form.  It means that after an automorphism of $(\mathbb{Z}/q)^n$, any submodule $V$ can be put into a standard form in which it is generated by vectors of the form $d_k e_k$, where $e_k$ is a standard basis vector, $d_k$ is a divisor of $q$, and each $k$ only appears at most once.  In that case you can check directly that $(V^\perp)^\perp$ is no larger than $V$.
(I'm taking the question in the more interesting case in which $q$ might not be prime.)