ThisCalculator

Statistics

Expected Value and Variance Calculator

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Expected Value and Variance Calculator

This calculator computes the expected value (mean) and variance of a discrete probability distribution. You enter the possible outcomes and their probabilities, and it returns the mean, variance, and standard deviation, along with the formulas used. It works for any finite set of values with probabilities that sum to 1.

Formula

For a discrete random variable X with outcomes xi and probabilities pi, the expected value (mean) is:

E(X) = Σ xi · pi

The variance is the average squared deviation from the mean:

Var(X) = Σ (xi − E(X))² · pi

The standard deviation is the square root of the variance: SD = √Var(X).

Here, xi are the numeric outcomes (unitless or in whatever unit your data uses), pi are their probabilities (as decimals or fractions, summing to 1), and n is the number of outcomes. The calculator normalizes probabilities internally if they don’t sum to exactly 1, so you can also enter weights or frequencies.

Worked Example

Using the default values from the calculator: outcomes 1,2,3,4,5,6 with probabilities 0.1667 each (a fair six-sided die).

  1. Expected value: (1×0.1667) + (2×0.1667) + (3×0.1667) + (4×0.1667) + (5×0.1667) + (6×0.1667) = 0.1667 × 21 = 3.5
  2. Variance: (1−3.5)²×0.1667 + (2−3.5)²×0.1667 + … + (6−3.5)²×0.1667 = (6.25 + 2.25 + 0.25 + 0.25 + 2.25 + 6.25) × 0.1667 = 17.5 × 0.1667 = 2.9167
  3. Standard deviation: √2.9167 = 1.7078

The calculator rounds the expected value to 3.5, variance to 2.9167, and standard deviation to 1.7078. Note that the default probabilities are rounded to four decimals, so the sum is 1.0002 – the calculator normalizes this automatically.

When to Use This Calculator

Use this tool whenever you have a finite set of possible outcomes with known probabilities. Common applications include:

  • Analyzing games of chance (dice, cards, spinners)
  • Evaluating risk in insurance or finance (loss amounts with probabilities)
  • Comparing investment returns with different scenarios
  • Quality control (number of defects per batch)
  • Any decision under uncertainty where you want the average outcome and its spread

The expected value tells you the long-run average if you repeated the experiment many times. The variance (or standard deviation) tells you how much individual results typically deviate from that average. A low variance means results cluster tightly around the mean; a high variance means wide swings.

How to Read the Results

The expected value is not necessarily one of the outcomes – for a die it’s 3.5, which never appears. It’s a weighted average, not a prediction of a single trial. The variance is in squared units (e.g., if outcomes are dollars, variance is in dollars squared), which is why the standard deviation is often more interpretable because it’s in the original units.

For example, if you’re evaluating a lottery ticket with outcomes $0 (prob 0.9), $10 (prob 0.09), and $100 (prob 0.01), the expected value is 0×0.9 + 10×0.09 + 100×0.01 = $1.90. That means on average you get back $1.90 per ticket – but most tickets pay nothing. The standard deviation would be large, reflecting the high variability.

Common Mistakes and Pitfalls

  • Probabilities not summing to 1: If you enter 0.2, 0.3, 0.4, the calculator normalizes, but you should double-check your inputs. If they represent percentages (20%, 30%, 40%), enter 0.2, 0.3, 0.4, not 20, 30, 40.
  • Mixing units: All outcomes must be in the same unit. Don’t mix dollars and cents, or meters and centimeters.
  • Using sample variance formula: This calculator uses the population variance (divides by the sum of probabilities, which is 1). If you have a sample of data rather than a full distribution, use the sample variance formula (divide by n−1) – this calculator is not for raw data lists.
  • Confusing variance and standard deviation: Variance is the average squared deviation; standard deviation is its square root. Both are shown here.
  • Assuming expected value is a typical outcome: It’s an average, not a mode or median.

Limitations and Alternatives

This calculator only handles discrete distributions with a finite number of outcomes. For continuous distributions (like normal, exponential, or uniform over an interval), you need integration, not summation – those have their own calculators. For raw data sets (a list of observations without probabilities), use a descriptive statistics calculator that computes sample mean and variance.

Also, this calculator assumes you know the true probabilities. In real life, probabilities are often estimated from data – that’s a different problem (inference). The expected value is sensitive to extreme outcomes; a single very large outcome with tiny probability can dominate the mean (e.g., a lottery jackpot).

Frequently Asked Questions

What is the difference between expected value and mean?

They are the same thing when the probabilities are equal (uniform distribution). The expected value is a weighted mean where each outcome is weighted by its probability. For a fair die, the mean of the numbers 1–6 is (1+2+3+4+5+6)/6 = 3.5, same as the expected value. The term “expected value� is used in probability theory; “mean� is used in statistics for observed data.

Can I enter percentages instead of decimals?

Yes, but you must convert them to decimals first (e.g., 25% becomes 0.25). The calculator does not interpret the percent sign. If you enter 25, 50, 25, it will treat them as weights and normalize them to 0.25, 0.5, 0.25 – so it actually works, but the displayed probabilities will be normalized. For clarity, use decimals.

What if my probabilities don’t sum to exactly 1?

The calculator normalizes them by dividing each by the total sum. This is useful if you have weights or frequencies (e.g., 10, 20, 30). However, if the sum is very different from 1 (like 0.5), you likely made an error – check your inputs.

Why is variance in squared units?

Because you square the deviations from the mean. If your outcomes are in dollars, the deviations are in dollars, and squaring them gives dollars squared. That’s why the standard deviation (square root) is often preferred – it’s back in dollars. For example, a variance of 4 dollars² means a standard deviation of 2 dollars.

Does a higher variance always mean higher risk?

In finance and gambling, yes – higher variance means more uncertainty in the outcome. But it’s not inherently “badâ€�; a high-variance investment could have high upside. The expected value tells you the average, and variance tells you the risk around that average. Two distributions can have the same mean but very different variances.

Can I use this for a continuous distribution?

No. This calculator requires discrete outcomes. For a continuous distribution, you’d need the probability density function and integration. For example, the uniform distribution between 0 and 10 has expected value 5 and variance 100/12 ≈ 8.33, but you can’t enter that here as a list of outcomes.

Related

Formula used
in x | Outcomes (comma-separated) | - | 1,2,3,4,5,6 | 0
in p | Probabilities (comma-separated) | - | 0.1667,0.1667,0.1667,0.1667,0.1667,0.1667 | 0
out ev | Expected value | - | sum(x*p)/sum(p) | 4
out var | Variance | - | sum((x-ev)^2*p)/sum(p) | 4
out sd | Standard deviation | - | sqrt(var) | 4

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.