# Finding an approximation to the Heaviside function

I'm having difficulty answering this question:

Questions statement:

Consider the function: $$f(x) = \begin{cases} 0 & \text{if x\leq 0,}\\ e^{-\frac{1}{x}} & \text{otherwise.} \end{cases}$$

Show that there exists a positive function $$g(x)\in C^{\infty}(\mathbb{R})$$ that cancels outside the interval $$]-1,1[$$ and that satisfies:

$$1=\int_{\mathbb{R}}^{} g(x) dx$$.

Thoughts on what to do

1) I can show that $$f$$ is infinitely differentiable and define the function $$g$$ by displacing $$f$$ over the interval $$]-1,1[$$ and define $$g$$ such that it's zero outside the interval $$]-1,1[$$ - this effectively solves the first part of the question

2) My problem is that I don't know how to guaranty the condition $$1=\int_{\mathbb{R}}^{} g(x) dx$$ without evaluating directly $$\int_{\mathbb{R}}^{} g(x) dx$$ which in my mind doesn't have an analytical solution. I think it's the equality here that's got me stumped.

Any help would be appreciated

If we define $$f$$ by f(x)=\left\{\begin{aligned} &0 &\text{if } x\notin ]-1,1[ \\ &e^{-\frac{1}{1-x^2}} &\text{if } x\in ]-1,1[ \end{aligned}\right. (this is kinda your function $$f$$) then $$f$$ is $$\mathcal{C}^{\infty}$$ and you can take $$g=\frac{f}{\int_{\mathbb{R}}f}$$ I think this is the best example and the one expected.
• Use the linearity of the inegral : $\int_{\mathbb{R}}\lambda f=\lambda\int_{\mathbb{R}}f$, applying this with $\lambda=\frac{1}{\int_{\mathbb{R}}f}$ you get $\int_{\mathbb{R}}{g}=\frac{\int_{\mathbb{R}}f}{\int_{\mathbb{R}}f}=1$. Sep 15, 2019 at 23:41