Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Variance Var(X)
0.49
σ² of the distribution
Mean μ = Σ pᵢxᵢ 2.1
E[X²] = Σ pᵢxᵢ² 4.9
Standard deviation σ 0.7
Σ pᵢ (should be 1) 1

What This Calculator Does

This tool computes the variance and standard deviation of a discrete random variable from its probability distribution. You supply each possible outcome (\(x_i\)) and the probability of that outcome (\(p_i\)), and the calculator returns the variance Var(X), the mean \(\mu\), the expected value of \(X^2\), and the standard deviation \(\sigma\). Variance measures how spread out the outcomes are around the mean — a small variance means outcomes cluster near the average, while a large variance means they are widely dispersed.

How to Use It

Enter the outcomes as a comma-separated list in the first box (for example 1, 2, 3). Enter the matching probabilities in the same order in the second box (for example 0.2, 0.5, 0.3). The probabilities should sum to 1; the calculator reports \(\sum p_i\) so you can verify this. Click calculate to see the variance and related statistics.

The Formula Explained

The variance uses the convenient computational form:

$$\operatorname{Var}(X) = \sum p_i x_i^{2} - \left(\sum p_i x_i\right)^{2}$$

Here \(\sum p_i x_i\) is the mean \(\mu = E[X]\), and \(\sum p_i x_i^{2}\) is \(E[X^2]\). Subtracting the square of the mean from \(E[X^2]\) gives the variance. This is algebraically identical to the definition \(\operatorname{Var}(X) = \sum p_i (x_i - \mu)^2\) but is easier to compute in one pass. The standard deviation is simply \(\sigma = \sqrt{\operatorname{Var}(X)}\).

Advertisement
Bar chart of a discrete probability distribution with mean line and spread arrows
Variance measures how the outcomes spread around the mean of the distribution.

Worked Example

Suppose X takes values 1, 2, 3 with probabilities 0.2, 0.5, 0.3. The mean is $$\mu = 1(0.2) + 2(0.5) + 3(0.3) = 0.2 + 1.0 + 0.9 = 2.1.$$ $$E[X^2] = 1(0.2) + 4(0.5) + 9(0.3) = 0.2 + 2.0 + 2.7 = 4.9.$$ So $$\operatorname{Var}(X) = 4.9 - 2.1^{2} = 4.9 - 4.41 = 0.49,$$ and \(\sigma = \sqrt{0.49} = 0.7\).

Table mapping outcomes and probabilities to weighted squared values feeding the variance formula
Each outcome contributes \(p_i x_i\) and \(p_i x_i^{2}\) to the two sums in the variance formula.

FAQ

Do the probabilities have to add to 1? Yes, for a valid distribution. The calculator shows \(\sum p_i\) so you can confirm. If it isn't 1, your results will be inaccurate.

What is the difference between variance and standard deviation? Variance is in squared units; standard deviation is its square root, expressed in the same units as X, which makes it easier to interpret.

Can variance be negative? No. Mathematically variance is always \(\geq 0\). A negative result indicates a data-entry error in the probabilities.

Last updated: