# example of a function with compact support

Can you give an example of a function which is $C^\infty (\mathbb{R})$ having support on (-1,1) such that $\int_{-1}^1 f(x)\,dx$=1 and $\int_{-1}^1 xf(x)\,dx$=0. Thank you.

-
Begin by proving that $e^{-1/(x-1)^2(x+1)^2}$ for $-1\lt x\lt1$, $0$ elsewhere, is infinitely differentiable with support $(-1,1)$. – Gerry Myerson Jan 22 '13 at 6:37

Let $b(x) = 1_{(0,\infty)} e^{-\frac{1}{x}}$. Then let $g(x) = b(x+1) b(1-x)$, and $f(x) = \frac{g(x)}{\int g}$. $f$ is $C^\infty$, $\text{supp } f = [-1,1]$. By construction, $\int f = 1$ and since $f$ is even, we have $\int_{-1}^1 x f(x) dx = 0$.
You can prove the following function to be in $C_0^{\infty}(\mathbb R)$ $$h(x) = \begin{cases} 0 &\mbox{if } |x| \ge 1 \\ \exp\Bigl(-\frac{1}{1-|x|^2}\Bigr) & \mbox{if } |x| < 1. \end{cases}$$ Now normalize it to get $$f(x) :=\frac{h(x)}{\int_{-1}^1 h(x) dx}$$ Note that this function is symmetric and $g(x)=x$ is antisymmetric. What do you know about $$\int_{-a}^a u(x) v(x) dx$$ where $u(x)$ is symmetric and $v(x)$ is antisymmetric?