Suppose $p(x)$ approximates the density of interest $q(x)$. Then $$\int f(x) q(x) = \int f(x) \left(\frac{q(x)}{p(x)} \right) p(x) \ dx = E_{p(x)} f(x) \left(\frac{q(x)}{p(x)} \right)$$
Why don't the $p(x)$'s cancel in the second equality?
Suppose $p(x)$ approximates the density of interest $q(x)$. Then $$\int f(x) q(x) = \int f(x) \left(\frac{q(x)}{p(x)} \right) p(x) \ dx = E_{p(x)} f(x) \left(\frac{q(x)}{p(x)} \right)$$
Why don't the $p(x)$'s cancel in the second equality?