You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

借助伽马函数推导正态分布方差的积分求解疑问

Fixing the Integral Issue in Normal Distribution Variance Derivation

Hey there! Let's work through this together—your question points to a common pitfall when using the gamma function to derive the normal distribution's variance, so let's break it down step by step.

First, let's spot a critical red flag: the integral you've ended up with—$$2\int_{-\infty}^\infty ue^{-u}du$$—actually diverges (it doesn't resolve to a finite value). That's a clear sign there's a misstep in your variable substitution, because the variance of a normal distribution is always a finite, positive number. Let's correct that and tie it back to the gamma function properly.

Why Your Current Integral Fails

Let's split your integral into two parts to see why it doesn't converge:

  • Split into: $$\int_{-\infty}^0 ue^{-u}du + \int_0^\infty ue^{-u}du$$
  • For the left-hand integral, substitute $v = -u$ (so $u = -v$, $du = -dv$). When $u \to -\infty$, $v \to \infty$; when $u=0$, $v=0$. This transforms the integral to:
    $$\int_{\infty}^0 (-v)e^{v}(-dv) = \int_{\infty}^0 ve^v dv = -\int_0^\infty ve^v dv$$
  • The integral $\int_0^\infty ve^v dv$ blows up to infinity, so the entire original integral can't produce a finite result. This means your substitution to reach this point was incorrect.

Correct Substitution for Normal Variance (Using Gamma Function)

Let's start fresh with the standard normal distribution ($\mu=0$, $\sigma=1$), since scaling to non-standard normals is straightforward later. The variance is:
$$\text{Var}(X) = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^\infty x^2 e{-\frac{x2}{2}}dx$$

Here's how to map this to the gamma function ($\Gamma(s) = \int_0^\infty u{s-1}e{-u}du$):

  1. Use evenness: The integrand $x^2 e{-\frac{x2}{2}}$ is even, so we can rewrite the integral as:
    $$\frac{2}{\sqrt{2\pi}} \int_0^\infty x^2 e{-\frac{x2}{2}}dx$$
  2. Substitute to match gamma form: Let $u = \frac{x^2}{2}$. This gives $x = \sqrt{2u}$, and $dx = \frac{du}{\sqrt{2u}}$.
  3. Plug into the integral: Substitute these values in, and simplify:
    $$\frac{2}{\sqrt{2\pi}} \int_0^\infty (2u) e^{-u} \cdot \frac{du}{\sqrt{2u}} = \frac{2}{\sqrt{2\pi}} \cdot \sqrt{2} \int_0^\infty u^{\frac{1}{2}} e^{-u}du$$
  4. Apply gamma function: The integral $\int_0^\infty u^{\frac{1}{2}} e^{-u}du$ is $\Gamma\left(\frac{3}{2}\right)$. We know $\Gamma\left(\frac{3}{2}\right) = \frac{\sqrt{\pi}}{2}$ (using the property $\Gamma(s+1) = s\Gamma(s)$ and $\Gamma\left(\frac{1}{2}\right) = \sqrt{\pi}$).
  5. Calculate the final result:
    $$\frac{2}{\sqrt{2\pi}} \cdot \sqrt{2} \cdot \frac{\sqrt{\pi}}{2} = 1$$
    Which is the correct variance for the standard normal distribution. For a general normal $N(\mu, \sigma^2)$, the variance is $\sigma^2$, which follows directly from scaling this result.

Key Takeaway

The mistake came from a variable substitution that didn't properly account for the quadratic exponent in the normal PDF. By adjusting your substitution to map $x^2$ to the linear term in the gamma function's exponent, you'll end up with an integral over $[0, \infty)$ that aligns perfectly with the gamma function's definition.

内容的提问来源于stack exchange,提问作者hippocampus

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:55:35