Background: I am trying to convince myself that the family of hash functions $H = \{h_{(a, b)} : \mathbb{Z}_p \rightarrow \mathbb{Z_p}, (a, b) \in \mathbb{Z}_p^2\}$, where $h_{(a, b)}(x) = ax + b \mod{p}$ with prime $p$, is a pairwise-independent family. While I realize there are simpler ways to do this, I can accomplish this if I show for any $x, y \in \mathbb{Z}$, $\Pr_{(a, b) \in \mathbb{Z}_p^2}(ax + b = y) = \frac{1}{p}$, which necessitates showing that there are exactly $p$ distinct pairs $(a, b) \in \mathbb{Z}$ such that $ax + b = y \mod p$. Owing to my weak understanding of field theory, I am unsure if this is true, let alone how to prove it. This leads to my question.
Question: Given $x, y \in \mathbb{Z}_p$, how many $(a, b) \in \mathbb{Z}_p^2$ are there such that $ax + b = y \mod p$?
If $x=0$ you have only one choice for $b$: $b=y$, and $p$ choiches for $a$, in total $p$ choiches: $(a,y)$, $a\in \mathbb Z_p$.
If $x\neq 0$, it is invertible, and for each choiche of $b$ you must take $a=(y-b)x^{-1}$, so also in this case you have $p$ choiches: $((y-b)x^{-1},b)$, $b\in \mathbb Z_p$.