Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to bound a 1D gaussian/normal (or similar) probability density function in the domain interval $[-3\sigma, 3\sigma]$ in a way that still integrates to 1. I would need something like this:

$$ p(x) = \begin{cases} N(x;\mu, \sigma) &\text{if } -3\sigma \leq x \leq 3\sigma\\ 0 & \text{otherwise } \end{cases} $$

This is NOT a probability density function but how could I get a bounded distribution that is similar to the gaussian case?

Thanks in advance,


share|cite|improve this question
All you have to do is to divide $p(x)$ over by $\int_{-3 \sigma}^{3 \sigma} p(x) \mathrm{d} x$. – Sasha Sep 5 '11 at 13:51
Agree with Shasha. Unless you want to demand that your function should vanish smoothly, then you'll need something else... – valdo Sep 5 '11 at 13:59
Thanks Sasha and valdo. What I actually need is that it vanished smoothly; I haven't commented on it in the question... – Federico Sep 5 '11 at 14:09
Do you know about bump functions? – cardinal Sep 5 '11 at 14:44
If you just want something that looks similar, have you considered a scaled and centered beta distribution? – guy Nov 4 '11 at 23:09

I don't think bump functions will help, because the Gaussian does not have compact support. I am not quite sure what you really need. If it still integrates to one, why is it not a probability density? Why not make a simple transformation of coordinates? This will still integrate to one, should be sufficiently smooth: $f(x)=\exp\left(\frac{-\tan\left(\frac{\pi}{2}\frac{x}{3\sigma}\right)^2}{2}\right)\mathbb{1}_{(x<3\sigma)}(x)$

share|cite|improve this answer
The point of my comment was to consider transforming the Gaussian into a bump function by using the appropriate mapping from $(-\infty, \infty)$ to $(-3\sigma, 3\sigma)$. – cardinal Sep 5 '11 at 18:32
@cardinal Another natural approach is to mollify the truncated distribution. This means define a "bump function" $\psi$ supported on $[-3\sigma, 3\sigma]$, equal to $1$ on $[-3\sigma+\varepsilon, 3\sigma-\varepsilon']$ for arbitrarily small positive $\varepsilon$, $\varepsilon'$. Normalizing the function $x \to \psi(x) \exp(-(x/\sigma)^2/2)$ does the trick. – whuber Sep 6 '11 at 16:39
@whuber, yes, I like that approach, too. – cardinal Sep 6 '11 at 16:47

It seems you are not clear about what you want. To truncate any variable to a given range, you just restrict its density to that range, and divide by its integral so that integrates to 1. But if you want to generate a random variable that just "looks like" a gaussian, but has support on an interval, and its density is smooth, you can sum three (or more) uniforms. For example, if you sum three uniforms in $[-1,1]$, the result is a random variable that has support in $[-3,3]$, and its variance is $1$; you can multiply the result by $\sigma$ to get a suport $[-3 \sigma,3 \sigma]$ and standard deviation $\sigma$. The density is piecewise quadratic, it's continuous and derivable (though not infinitely differentiable, of course).

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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