# Monte Carlo - Importance sampling using normal distribution as sampling distribution

Suppose that I want to approximate an integral over finite range, say for example 0 to 10 using the Monte Carlo method.

Can I choose a normal distribution as the sampling distribution even though the interval of integral of a normal random variable is the whole real line instead of [0,10]?

Example,

$$I = \int_{0}^{10} exp(-2|x-5|) dx$$

Let $f(X)$ be the pdf of $N(5,1)$.

Then,

$$I = \int_{0}^{10} \dfrac{exp(-2|x-5|)}{f(x)} f(x) dx$$

But $I \neq E_f\bigg[\dfrac{exp(-2|X-5|)}{f(X)}\bigg]$ and thus I cannot approximate $I$ with

$$\dfrac{1}{n} \sum_{i=1}^{n}\dfrac{exp(-2|X_i -5|)}{f(X_i)}$$

Appreciate any help. :)

Suggestions:

1. Truncated normal distribution

Let $C = P(0< X <10)$. Then, the truncated $N(5,1)$ has pdf $g(x) = \dfrac{1}{C} f(x)$ for $x\in [0,10]$ and $g(x)=0$ otherwise.

Also,

$$I = \int_{0}^{10} \dfrac{exp(-2|x-5|)}{g(x)}g(x) dx = E_g\bigg[\dfrac{exp(-2|X-5|)}{g(X)}\bigg]$$

and hence,

$$\hat{I} = \dfrac{1}{n}\sum_{i=1}^{n} \dfrac{exp(-2|X_i-5|)}{g(X_i)}$$

2. Normal distribution

$$I = \int_{0}^{10} exp(-2|x-5|) dx = \int_{-\infty}^{\infty} exp(-2|x-5|)1_{\{0\leq x \leq 10\}} dx = \int_{-\infty}^{\infty} \dfrac{exp(-2|x-5|)1_{\{0\leq x\leq10\}}}{f(x)} f(x) dx = E_f\bigg[\dfrac{exp(-2|X-5|)1_{\{0\leq X \leq 10\}}}{f(X)}\bigg]$$

Hence,

$$\hat{I} = \dfrac{1}{n}\sum_{i=1}^{n} \dfrac{exp(-2|X_i-5|)1_{\{0\leq X_i\leq 10\}}}{f(X_i)} \text{ , where } X_i \text{are iid rvs ~} N(5,1).$$

You are correct that your last expression will not approximate your integral of interest. However, you are close. Instead, try the following: $$\dfrac{1}{n} \sum_{i=1}^{n}\dfrac{exp(-2|X_i -5|)}{f(X_i)}1(0 \le X_i \le 10).$$ For samples that do not fall into the range $[0,10]$, the corresponding fraction summand will be equal to $0$. By the law of large numbers, this will converge to the integral you are interested in.
• Can you show the expression of $I$? May 10, 2018 at 5:18
• @yh016 the sample average converges to the true average. That true average, or expectation, is taken with respect to $f$. And the indicator function is another way to write the bounds of the integral. May 10, 2018 at 14:14
• @yh016 $\dfrac{1}{n} \sum_{i=1}^{n}\dfrac{exp(-2|X_i -5|)}{f(X_i)}1(0 \le X_i \le 10) \to E\left[ \dfrac{exp(-2|x -5|)}{f(x)}1(0 \le x \le 10)\right] = \int \dfrac{exp(-2|x -5|)}{f(x)}1(0 \le x \le 10) f(x) dx = \int exp(-2|x -5|)1(0 \le x \le 10) dx = I$. May 10, 2018 at 16:16