Solving a Non-Exact First-Order ODE

Consider the implicit differential equation: $$(45y^3+33xy)dx+(50xy^2+18x^2)dy=0$$ Show that $x^py^q$ is an integrating factor of this equation, and find the explicit values of $p$ and $q$. Then, use the integrating factor to obtain a solution in implicit form.

I have learned about the two special cases, where the integrating factor may be a function of $x$ only or $y$ only, but in this case, neither is true; thus, the integrating factor must be a function of both.

We know that a non-exact ODE of the form $M(x,y)dx+N(x,y)dy=0$ can be made exact if and only if $\frac{\partial}{\partial y}[\mu(x,y)M(x,y)]=\frac{\partial}{\partial x}[\mu(x,y)N(x,y)]$, where $\mu(x,y)$ is the integrating factor. I just don't know how to apply this formula in a more general manner, without resorting to the two special cases. Any help would be appreciated.

There is no problem of principle in applying the formula you give yourself: Just put $\mu (x,y) \ = \ x^py^q$ and find

$$\partial_y(45x^py^{q+3} + 33x^{p+1}y^{q+1}) = \partial_x(50x^{p+1}y^{q+2} + 18x^{p+2}y^{q})$$

which gives

$$(3+q)45x^p y^{q+2} + (1+q)33x^{p+1}y^{q} \ = \ 50(p+1)x^p y^{q+2} + 18(p+2)x^{p+1}y^q \, .$$

Comparing coefficients gives the two linear equations

$$(3+q)45 \ = \ 50(p+1)$$

and

$$(1+q)33 \ = \ 18(p+2) \, ,$$

whose solution is $p \ = \ 3,5; q \ = \ 2$, if I made no mistake. Inserting those values, you can then choose, whether you want to integrate

$45x^{3,5}y^5 + 33x^{4,5}y^3$

with respect to $x$ or

$50x^{4,5}y^4 + 18x^{5,5}y^2$

with respect to $y$ in order to find your function $f(x,y)$, whose level sets $f(x,y) \ = \ c$ constitute the solutions, if I remember correctly, it is quite some time ago I did this.