Probability Distribution Calculator

Validate a PMF or PDF, then find probabilities, the mean, and the variance with step-by-step working
Is p(x) = x/10 for x = 1, 2, 3, 4 a valid probability mass function?
Find k so that P(0)=0.1, P(1)=0.3, P(2)=k, P(3)=0.25 is a valid PMF
Mean and variance of the distribution x = 0,1,2,3 with p = 0.1, 0.3, 0.35, 0.25
Find c so that f(x) = c x^2 on [0, 2] is a probability density function

What a Probability Distribution Is

A probability distribution assigns probability to every value a random variable can take. The form depends on whether the variable is discrete or continuous.

Discrete — probability mass function (PMF) p(x)=P(X=x)p(x) = P(X = x). It is valid if and only if both conditions hold:

p(x)0 for all xandall xp(x)=1p(x) \ge 0 \text{ for all } x \qquad \text{and} \qquad \sum_{\text{all } x} p(x) = 1

Continuous — probability density function (PDF) f(x)f(x), valid when

f(x)0andf(x)dx=1f(x) \ge 0 \qquad \text{and} \qquad \int_{-\infty}^{\infty} f(x)\,dx = 1

For a PDF, f(x)f(x) is not a probability — it is a density, and it may exceed 11. Probability is area: P(aXb)=abf(x)dxP(a \le X \le b) = \int_a^b f(x)\,dx, which also means P(X=a)=0P(X = a) = 0 for any single point.

The cumulative distribution function (CDF) is F(x)=P(Xx)F(x) = P(X \le x) in both cases: a running sum for a PMF, an integral for a PDF.

Mean, Variance, and Building the Table

Discrete case

μ=E[X]=xp(x)σ2=(xμ)2p(x)=E[X2]μ2\mu = E[X] = \sum x \, p(x) \qquad \sigma^2 = \sum (x - \mu)^2 p(x) = E[X^2] - \mu^2

The right-hand form E[X2]μ2E[X^2] - \mu^2 is the computational shortcut: build one column of xp(x)x\,p(x) and one of x2p(x)x^2 p(x), total both, then subtract μ2\mu^2. The standard deviation is σ=σ2\sigma = \sqrt{\sigma^2}.

Continuous case

μ=xf(x)dxσ2=x2f(x)dxμ2\mu = \int x f(x)\,dx \qquad \sigma^2 = \int x^2 f(x)\,dx - \mu^2

Building a distribution from scratch

  1. List every distinct value the variable can take — the values must be exhaustive and mutually exclusive.
  2. Assign each one its probability, usually by counting outcomes.
  3. Verify the total is exactly 11. If a probability is unknown, that equation solves for it.
  4. Only then compute μ\mu, σ2\sigma^2, or any P(Xk)P(X \ge k).

A valid distribution requires no assumption about normality or sample size — those conditions belong to inference, not to the distribution itself.

Common Mistakes to Avoid

  • Forgetting to check the sum. A table that totals 0.950.95 or 1.051.05 is not a distribution, and every mean or variance computed from it is meaningless.
  • Allowing a negative probability. A formula such as p(x)=(x3)/6p(x) = (x-3)/6 may sum to 11 yet still produce a negative value; both conditions must hold, not just one.
  • Treating a density as a probability. For a continuous variable f(2)=1.5f(2) = 1.5 is perfectly legal. Only areas are probabilities, so always integrate.
  • Using (xμ)2/n\sum (x - \mu)^2 / n. That is the formula for raw data. For a distribution you weight by p(x)p(x), not by 1/n1/n.
  • Subtracting μ\mu before squaring in the shortcut. The identity is E[X2]μ2E[X^2] - \mu^2, never E[X2μ2]E[X^2 - \mu^2] computed halfway.
  • Mixing up P(X2)P(X \ge 2) and P(X>2)P(X > 2). For a discrete variable these differ by the whole of p(2)p(2); for a continuous one they are equal.

示例题目

Step 1: Non-negativity: all of 0.1,0.2,0.3,0.40.1, 0.2, 0.3, 0.4 are 0\ge 0
Step 2: Total: (1+2+3+4)/10=10/10=1(1 + 2 + 3 + 4)/10 = 10/10 = 1 ✓ — valid PMF
Step 3: μ=xp(x)=(12+22+32+42)/10=30/10=3\mu = \sum x\,p(x) = (1^2 + 2^2 + 3^2 + 4^2)/10 = 30/10 = 3
Step 4: E[X2]=x2p(x)=(13+23+33+43)/10=100/10=10E[X^2] = \sum x^2 p(x) = (1^3 + 2^3 + 3^3 + 4^3)/10 = 100/10 = 10
Step 5: σ2=1032=1\sigma^2 = 10 - 3^2 = 1, so σ=1\sigma = 1
Answer: Valid PMF with μ=3\mu = 3, σ2=1\sigma^2 = 1, σ=1\sigma = 1

Step 1: Sum to 1: 0.1+0.3+k+0.25=1k=10.65=0.350.1 + 0.3 + k + 0.25 = 1 \Rightarrow k = 1 - 0.65 = 0.35
Step 2: P(X2)=0.35+0.25=0.60P(X \ge 2) = 0.35 + 0.25 = 0.60
Step 3: μ=0(0.1)+1(0.3)+2(0.35)+3(0.25)=0+0.3+0.7+0.75=1.75\mu = 0(0.1) + 1(0.3) + 2(0.35) + 3(0.25) = 0 + 0.3 + 0.7 + 0.75 = 1.75
Step 4: E[X2]=0+1(0.3)+4(0.35)+9(0.25)=0.3+1.4+2.25=3.95E[X^2] = 0 + 1(0.3) + 4(0.35) + 9(0.25) = 0.3 + 1.4 + 2.25 = 3.95
Step 5: σ2=3.951.752=3.953.0625=0.8875\sigma^2 = 3.95 - 1.75^2 = 3.95 - 3.0625 = 0.8875
Step 6: σ=0.88750.942\sigma = \sqrt{0.8875} \approx 0.942
Answer: k=0.35k = 0.35, P(X2)=0.60P(X \ge 2) = 0.60, μ=1.75\mu = 1.75, σ0.942\sigma \approx 0.942

Step 1: 02cx2dx=c[x33]02=8c3=1c=38\displaystyle\int_0^2 cx^2\,dx = c\left[\frac{x^3}{3}\right]_0^2 = \frac{8c}{3} = 1 \Rightarrow c = \frac{3}{8}
Step 2: f(x)=38x20f(x) = \tfrac{3}{8}x^2 \ge 0 on [0,2][0,2]
Step 3: P(X1)=0138x2dx=3813=18=0.125P(X \le 1) = \displaystyle\int_0^1 \tfrac{3}{8}x^2\,dx = \tfrac{3}{8}\cdot\tfrac{1}{3} = \tfrac{1}{8} = 0.125
Step 4: E[X]=02x38x2dx=38[x44]02=384=1.5E[X] = \displaystyle\int_0^2 x \cdot \tfrac{3}{8}x^2\,dx = \tfrac{3}{8}\left[\frac{x^4}{4}\right]_0^2 = \tfrac{3}{8} \cdot 4 = 1.5
Answer: c=3/8c = 3/8, P(X1)=0.125P(X \le 1) = 0.125, E[X]=1.5E[X] = 1.5

常见问题

A probability mass function gives the probability that a discrete random variable equals each specific value, written p(x) = P(X = x). It is valid only if every value is non-negative and all values together sum to exactly 1. Plotted, it looks like a bar or spike at each possible value.

A PMF applies to discrete variables and returns an actual probability at each point. A PDF applies to continuous variables and returns a density, so you must integrate over an interval to get a probability. That is why P(X = a) = 0 for a continuous variable but can be non-zero for a discrete one.

Test two things. First, the function must be non-negative everywhere in its domain. Second, the total must be exactly 1 — a sum for a PMF, an integral for a PDF. If a constant is unknown, setting the total equal to 1 is precisely the equation that determines it.

Add a column of x·p(x) and total it to get μ, then a column of x²·p(x) and total it to get E[X²]. The variance is σ² = E[X²] − μ². Do not divide by n — the probabilities are already the weights.

相关求解器

相关学习指南

免费试用 AI-Math

任何数学问题都能获得分步解答。拍照上传或输入问题即可。

开始解题