Skip to main content

Grades 8-12Free, no account needed

Expected value & variance calculator

Combine outcomes with exact probabilities to find expectation, second moment and variance, without silently normalizing an invalid distribution.

All calculators

Try your problem

1-20 comma-separated values, paired in order with probabilities. Press Ctrl+Enter to calculate.
Nonnegative probabilities must sum exactly to 1. Paste expect(-2,0,4;1/4,1/2,1/4). Press Ctrl+Enter to calculate.

Your calculations stay in this browser. No input history is saved.

Supported inputs and limits

Use matching lists of 1-20 outcomes and probabilities. Outcomes may be signed; each probability is from 0 to 1 inclusive and the exact sum must be 1. Duplicate outcomes and zero-probability rows are allowed. No normalization, unknown probability solving or continuous distribution mode. Scalars are signed integers, decimals with 1-6 decimal places, or integer fractions with positive denominator, at most 24 characters and 12 digits per integer part. Magnitude at most 1000000 and reduced denominator at most 1000000. No expressions, mixed numbers, repeating decimals, percent signs or scientific notation. Lists have at most 520 characters. All numerical answers and table values are exact rationals; diagram positions alone are approximate. Named paste commands are case-sensitive and at most 200 characters.

Understand the method

Outcomes -2, 0 and 4 have probabilities 1/4, 1/2 and 1/4. Their weighted contributions -1/2, 0 and 1 sum to expectation 1/2. The second moment is 5 and variance is 19/4.

A finite probability model pairs each numerical outcome x with a nonnegative probability p. Probabilities must sum to exactly 1. The expected value E[X] is the sum of p times x, not the unweighted average of the listed outcomes.

Compute the second moment E[X squared] by summing p times x squared. Variance is E[X squared] minus E[X] squared; independently check it by summing p times (x - E[X]) squared. Variance is nonnegative and has squared outcome units.

Expectation describes a long-run average and need not be one possible outcome. Duplicate numerical outcomes may be separate rows or combined by adding their probabilities. Zero-probability rows contribute nothing and do not bound the positive-probability range of the mean.

Worked examples

Read the reasoning, or load an example into the calculator.

Expectation need not be possible

For -2,0,4 with probabilities 1/4,1/2,1/4, E[X]=-1/2+0+1=1/2. E[X squared]=5, so variance=5-1/4=19/4. The mean 1/2 is not a listed outcome.

Ignore an impossible outlier

Outcomes 999 and 3 with probabilities 0 and 1 give expectation 3 and variance 0. The zero-probability 999 contributes nothing.

Combine duplicate outcomes

Rows 1,1,5 with probabilities 1/4,1/4,1/2 are equivalent to outcomes 1,5 with probabilities 1/2,1/2. Expectation=3, second moment=13 and variance=4.

Try it without the calculator

Three questions for practice, not a graded school assessment. Your answers stay on this page and are not saved.

1. What is E[X] for outcomes 0 and 10 with probabilities 3/4 and 1/4?
2. Are probabilities 0.333333,0.333333,0.333333 accepted?
3. Must expectation be a possible outcome?

Original Testinar learning content. This local preview is awaiting final review before publication.

Page UP