Here’s the first part of the question to get you going ...
For $(a-b)^9$, $\displaystyle T_{r+1} = \binom{9}{r+1} a^{9-(r+1)}(-b)^{r+1}$
$T_{r+1} = \dfrac{9!}{(r+1)!(8-r)!} (2x)^{8-r} \left(-\dfrac{1}{2x^2}\right)^{r+1} = \dfrac{9!}{(r+1)!(8-r)!} (-1)^{r+1} \cdot 2^{7-2r}x^{6-3r}$
Multiplying this term by $x^h$ would yield the variable factor as $x^{6-3r+h} = x^{-3} \implies 3r-h=9$