Importance sampling is a method to evaluate an integral of the form $$E[h(X)] = \int h(x)f(x) dx$$ when this cannot be directly computed. Instead of sampling from the density $$f$$ as in classical Monte Carlo integration, importance sampling (IS) samples from an arbitrary density $$g$$ which must be a valid pdf: $$E[h(X)] = \int h(x)\frac{f(x)}{g(x)}g(x) dx$$ Based on samples $$X_1,...,X_n$$ generated from $$g$$ (and not from $$f$$), the expectation under $$g$$ converges in probability to $$\frac{1}{n} \sum_{j=1}^{n} \frac{f(X_j)}{g(X_j)}h(X_j) \rightarrow E[h(X)]$$ as in classical Monte Carlo integration. IS has the advantage that it puts very little restrictions on the blanket function $$g$$. Usual choices for $$g$$ are standard distributions that are either easy to simulate or which are efficient in the approximation of the integral. Directly sampling from $$f$$ as in Monte Carlo integration is normally not efficient hence IS sampling requires fewer samples to achieve the desired result.