Could anyone give me a function infinitely differentiable on the real line and having a compact support? And the function must be nonnegative and normalized, i.e. the integration of the function on the real line must be one.

I tried to think of one myself, but it seems trickier than expected.

  • 3
    $\begingroup$ You need to construct such a function out of a function such as $$f(x)=\begin{cases} e^{-1/x}, & x>0 \\ 0, & x\le 0\end{cases}.$$ $\endgroup$ May 15, 2015 at 16:56
  • $\begingroup$ I tried, but couldn't satisfy the compact support condition. $\endgroup$
    – Keith
    May 15, 2015 at 16:57
  • 2
    $\begingroup$ Ah, build another one, $g$, that dies smoothly at $x=1$, say, and then what can you do with the two of them? $\endgroup$ May 15, 2015 at 16:58
  • $\begingroup$ What about the function $f(x)=0$ for all $x$? $\endgroup$
    – Michael
    May 15, 2015 at 16:58
  • 2
    $\begingroup$ @Merideth: Everyone is doing the problem for you, but if you want to try to solve by thinking through what I said, do so, and then worry about normalizing the integral once you're done. $\endgroup$ May 15, 2015 at 17:06

3 Answers 3


The classic bump function is nice: $$f(x)=\begin{cases} e^{-\frac{1}{1-x^2}} & \textrm{if }|x|<1 \\ 0 & \textrm{otherwise}\\ \end{cases}$$

I doubt it's normalized, but you just need to divide it by $\int_{-1}^{1}f(t)\;dt$ to normalize.

  • $\begingroup$ Is f continuous ? As you have given differentiable so it should be but I not able to understand , can you please explain? $\endgroup$
    – Siddharth
    Feb 17, 2017 at 5:50

Let $a, r\ (r>0)$ be numbers. The function: $$f(x)=\begin{cases}\mathrm e^{\tfrac1{(x-a)^2-r^2}}&\text{if}\enspace \lvert x-a\rvert <r\\ 0&\text{if}\enspace \lvert x-a\rvert\ge r\end{cases},$$ is an example of a $\mathcal C^\infty$ function with support in $[a-r,a+r]$.


Fix $\varepsilon>0$ as small as you want and take $\frac{f}{\|f\|_{L^1}}$ with $$f(x)=\begin{cases}1&-\varepsilon\leq x\leq \varepsilon\\ \exp\left(-\frac{(|x|-\varepsilon)^2}{4\varepsilon^2-x^2}\right)&\varepsilon\leq |x|\leq 2\varepsilon\\ 0&|x|\geq 2\varepsilon \end{cases}.$$

Here an example for $\varepsilon=1/2$ ($f$ is not normalized): enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.