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┬аxandтИСall┬а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)тЙе0andтИлтИТтИЮтИЮf(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(aтЙдXтЙдb)=тИл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(XтЙдx)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]=тИСxтАЙp(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 xтАЙp(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(XтЙеk)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)=(xтИТ3)/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(XтЙе2)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.

Examples

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: ╬╝=тИСxтАЙp(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=10тИТ32=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=1тЗТk=1тИТ0.65=0.350.1 + 0.3 + k + 0.25 = 1 \Rightarrow k = 1 - 0.65 = 0.35
Step 2: P(XтЙе2)=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.95тИТ1.752=3.95тИТ3.0625=0.8875\sigma^2 = 3.95 - 1.75^2 = 3.95 - 3.0625 = 0.8875
Step 6: ╧Г=0.8875тЙИ0.942\sigma = \sqrt{0.8875} \approx 0.942
Answer: k=0.35k = 0.35, P(XтЙе2)=0.60P(X \ge 2) = 0.60, ╬╝=1.75\mu = 1.75, ╧ГтЙИ0.942\sigma \approx 0.942

Step 1: тИл02cx2тАЙdx=c[x33]02=8c3=1тЗТc=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)=38x2тЙе0f(x) = \tfrac{3}{8}x^2 \ge 0 on [0,2][0,2] тЬУ
Step 3: P(XтЙд1)=тИл0138x2тАЙdx=38тЛЕ13=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]=тИл02xтЛЕ38x2тАЙdx=38[x44]02=38тЛЕ4=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(XтЙд1)=0.125P(X \le 1) = 0.125, E[X]=1.5E[X] = 1.5

Frequently Asked Questions

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.

Related Solvers

Related Guides

Try AI-Math for Free

Get step-by-step solutions to any math problem. Upload a photo or type your question.

Start Solving