I have a problem understanding the piece of theory in the attachment. To be exact: why the does solution space of $a^\mathrm{T}x=0$ have dimension $n-1$ and how is the number of solutions calculated?
Please, help.
Typed-in quote from the "theory passage":
"For example, take $a\in \mathbb{Z}_p^n\setminus\{0\}$. From linear algebra you know that $\{x\in \mathbb{Z}_p^n\,|\,a^\mathrm{T}x=0\}$ is a vector space of dimension $n-1$. So you know that the equation $a^\mathrm{T}x=0$ has $p^{n-1}$ solutions."
Set $a = (a_1,...,a_n), x = (x_1,...,x_n)$, then $a^Tx = a_1x_1 + ... a_nx_n$. So it is an easy calculation that for any $x,y \in \mathbb{Z}_p^n$ and $r \in \mathbb{Z}_p$, you have $a^T(x+r \cdot y) = a^Tx + r \cdot a^Ty,$ hence $x \mapsto a^Tx$ can be considered as a linear map $ f\colon \mathbb{Z}_p^n \to \mathbb{Z}_p$.
Now I am sure you have heard of the following theorem: Let $f \colon V \to W$ be a linear map between finite-dimensional vector spaces $V,W$ over the same field, then $\dim (V) = \dim(Im(f)) + \dim(\ker(f)).$
In our case, $V = \mathbb{Z}_p^n$ is a vector space over $\mathbb{Z}_p$ and hence $\dim(\mathbb{Z}_p^n) = n$. In fact, it is easy to calculate $\dim(Im(f))$, as it is the rank of the $1 \times n$-matrix $(a_1,...,a_n)$. If we assume $a \neq (0,...,0)$, then there exists at least one $a_i$, which is not equal to $0$, and hence $rank((a_1,...,a_n))=1$.
You are particularly interested in the vector space $\ker(f) = \{ x \in \mathbb{Z}_p^n \mid a^Tx = 0\}$. From the formula, we know $\dim(\ker(f)) = \dim(\mathbb{Z}_p^n) - \dim(Im(f)) = n-1$.
The number of solutions to the equation $a^Tx = a_1x_1 + ... a_nx_n = 0$ is just the cardinality $|\ker(f)|$ of the kernel of $f$, since $\ker(f)$ is precisely the set of solutions of this equation. Since we can find a basis $\{v_1,...,v_{n-1}\}$ of $\ker(f)$ and each element in $\ker(f)$ is of the form $a_1 v_1 + ... + a_{n-1}v_{n-1}$, where $a_1,...,a_{n-1} \in \mathbb{Z}_p$, there are exactly $p^{n-1}$ elements contained in $\ker(f)$. (For any $a_i$ you have $p = |\mathbb{Z}_p|$ different choices, and you have to choice $n-1$-times.)