Let's say we have two distribution f(x)​ and g(x).​Now the problem is let's say you want to estimate the expectation of g(x)​but you can't sample from it, hence you won't be able to use sample mean to estimate the expectation. So what we do here is, we use samples from f(x)​to estimate the expectation of g(x)​.
So we know we can estimate the expectation of f(x)​ using sample mean by: