A collection of hash functions $H=\{h:\{0,1\}^n \to \{0,1\}^m\}$ is pairwise independent if for every $x_1 \neq x_2 \in \{0,1\}^n$ and $y_1, y_2 \in \{0,1\}^m$:

$$ \Pr_{h \leftarrow H}[h(x_1)=y_1 \wedge h(x_2)=y_2]=\frac{1}{2^{2m}} $$

Given a finite field $\mathbb{F}$ of size $2^n$ I've been able to prove for the set of hash functions:
$\{h_{a,b}: \mathbb{F}\to \mathbb{F}\}_{a,b \in \mathbb{F}}$ where: $h_{a,b}=ax+b$
that it is pairwise independent.

I am now asked to extend this for the case where the domain and range are not the same - - the former has size $2^n$ and the latter $2^m$.

I thought of the following as the extension, but I'm not sure whether it would work: choose $a,b \in \mathbb{F}_{2^m}$. The idea is that I need to have an inverse in the field in order to uniquely solve for $a,b$ (e.g. for $ax_1+b=y_1$ I want to solve for $a,b$ uniquely by finding $a=(y_1-b)x_1^{-1}$ and similarly for $b$ (a system of two equations mod $\mathbb{F}_{2^m}$) so that I get the aforementioned probability). A corollary would mean making sure $x_1, x_2$ are in the field, i.e. there are $a$ and $b$ such that $x_1=(y_1-b)a^{-1}$. Since $y_1 \in \mathbb{F}_{2^m}$ then it would be sufficient that also $a,b \in \mathbb{F}_{2^m}$.

I'm quite unsure whether this is correct. Any advice would be greatly appreciated.