Knowing that $\mathbb{Q}$ is countable, I must prove that $\mathbb{Q} \times \mathbb{Q}$ is countable.
Teacher's proof:
For each $a \in \mathbb{Q}$, let $A_a = \{(a,q) : q \in \mathbb{Q}\}$ so that $A_a \sim \mathbb{Q}$. So each $A_a$ is countable, as $\mathbb{Q}$ is known to be countable already. Since $\mathbb{Q} \times \mathbb{Q} = \bigcup_{a \in \mathbb{Q}} A_a$, and knowing that the union of countable sets is countable, we deduce that $\mathbb{Q} \times \mathbb{Q}$ is countable. (End of proof.)
How do I show exactly, based on the definition of $A_a$, that $A_a \sim \mathbb{Q}$? I thought about showing that $A_a$ and $\mathbb{Q}$ have the same cardinality. Is it possible to show that? Intuitively, if $\mathbb{Q}$ has a certain countable number of elements, and $(a,q)$ is based on fixed $a$ and variable $q$, so $A_a$ has that same number of elements as $\mathbb{Q}$.
Define a function $\phi_a:\mathbb Q\to A_a$ as follows: $$\phi_a(q)\equiv(a,q)\quad\forall q\in\mathbb Q.$$ Show that $\phi_a$ is injective [that is, $\phi_a(q_1)=\phi_a(q_2)$ implies $q_1=q_2$ for any $q_1,q_2,\in\mathbb Q$] and that it is also surjective [that is, each element of $A_a$ is the image of some $q\in \mathbb Q$ under $\phi_a$]. By the Cantor–Bernstein–Schröder theorem, this shows that $\mathbb Q$ has the same cardinality as $A_a$.
EDIT: As user84413 pointed out in a comment below, the Cantor–Bernstein–Schröder theorem is an overkill here. It is sufficient to observe that $\phi_a$ is a bijection.