Expected Value & Variance Calculator

Introduction

When outcomes are uncertain, a single answer rarely tells the whole story. A discrete random variable can produce several possible values, and each value comes with its own probability. The most useful quick summary is the expected value, which tells you the long-run average result if the same random process were repeated many times. Just as important is the variance, which tells you how tightly the outcomes cluster around that average or how widely they spread out. This calculator brings those ideas together so you can move from a raw list of outcomes and probabilities to a clear summary of what the distribution is doing.

The tool is especially helpful for classroom probability problems, games of chance, decision analysis, and introductory statistics. If you are comparing two wagers, two investments, or two possible policies, the expected value answers the question, What is the average payoff in the long run? Variance and standard deviation answer a different question, How stable or risky is that average? Two situations can share the same expected value while feeling completely different in practice because one is tightly concentrated and the other swings wildly from loss to gain.

In symbols, the expected value is often written as E [ X ] . You can think of it as the balancing point of all possible outcomes placed on a number line, where each probability acts like a weight. Variance then measures how far, on average, those weighted outcomes sit from that balancing point. That physical picture is a good mental model for almost every result this calculator produces.

How to Use

The form accepts up to five outcome-probability pairs. In each row, type one possible value of the random variable in the Value box and its matching probability in the Probability box. You do not have to fill every row; blank rows are ignored. This makes the calculator flexible enough for a short classroom example while still covering many common distributions. Negative values are allowed, so the calculator works for gains and losses, net profit problems, or any situation where an outcome can fall below zero.

After entering your pairs, click Calculate. The results area will show the expected value, variance, standard deviation, and the total probability from the entries you supplied. If your probabilities already add to 1, the calculator uses them directly. If they do not add to 1, the script automatically rescales them by dividing each probability by the total. That means you can also use proportional weights, counts, or partially simplified probabilities without stopping to normalize them yourself first.

It is worth paying attention to units while you enter data. If your values are in dollars, the expected value and standard deviation will also be in dollars, while the variance will be in dollars squared. If the values are test scores, the expected value and standard deviation are measured in score points, and the variance is measured in squared score points. This unit rule matters because variance is useful mathematically, but standard deviation is often easier to interpret in everyday language.

Once you have a result you like, the Copy Result button copies the visible summary text to your clipboard. That is convenient for homework notes, lab reports, or comparing several scenarios side by side. All calculations happen locally in your browser, so the page stays fast and your input never needs to leave your device.

Formula

Suppose a discrete random variable X can take on values x1, x2, ..., xn with corresponding probabilities p1, p2, ..., pn. The expected value is the weighted average of the outcomes:

Formula: E[X] = ∑ p_i x_i

E [ X ] = p i x i

This formula says to multiply each outcome by its probability and then add the products. If one outcome is large but extremely unlikely, it still influences the mean, but not as much as a common outcome with a larger probability weight. That is why expected value is not merely the midpoint of the smallest and largest numbers; it is a weighted center shaped by how likely each value is.

Variance uses that center to measure spread. For each outcome, compute the difference between the outcome and the expected value, square the difference, multiply by its probability, and then add all those weighted squared distances:

Formula: Var(X) = ∑ p_i (x_i-E[X])^2

Var ( X ) = p i ( x i - E [ X ] ) 2

The standard deviation is the square root of the variance. Taking the square root returns the spread to the same units as the original outcomes, which is why standard deviation is usually easier to discuss in plain language. A standard deviation of 5 dollars means something intuitive; a variance of 25 dollars squared is mathematically useful but less natural to interpret directly.

This calculator also handles the common case where the input probabilities do not sum exactly to 1 because of rounding or because you entered relative weights. The script adds all the supplied probabilities to get a total and then divides each probability by that total before computing the summary measures. In effect, it converts your inputs into a proper probability distribution while preserving their relative importance.

Worked Example

Consider a simple game. You win $10 with probability 0.2, win $5 with probability 0.5, and lose $3 with probability 0.3. Entering the three pairs (10, 0.2), (5, 0.5), and (-3, 0.3) gives an expected value of 10 × 0.2 + 5 × 0.5 + -3 × 0.3 = 3.6 . The long-run average gain is therefore $3.60 per play.

To compute the variance, the calculator compares each outcome with 3.6, squares the distance, weights it by the corresponding probability, and adds the results. Here that gives a variance of 25.44 and a standard deviation of about 5.04. The average payoff is positive, but the standard deviation reminds you that a single play can still land far above or far below the average. That combination of a favorable mean and a sizable spread is exactly the sort of tradeoff that expected value and variance are meant to describe together.

Interpreting Results

The expected value is not a promise about the next trial. If a fair die has expected value 3.5, that does not mean a single roll can ever land on 3.5. Instead, it means that the average of many rolls approaches 3.5 over time. The same logic applies to money, scores, waiting times, and any other measurable outcome. Expected value describes the long-run center, not the immediate next observation.

Variance and standard deviation tell you how much fluctuation to expect around that center. A small variance means the outcomes tend to stay close to the mean. A large variance means the outcomes are spread farther out. In practical decisions, this matters because people often care not only about average return but also about reliability. A job with a predictable bonus structure can feel safer than one with the same average bonus but much greater uncertainty.

The following table shows a few compact examples. Notice that similar averages can hide very different levels of spread.

Outcome Values Probabilities Expected Value Variance
1, 2, 3 1/3 each 2 2/3
-1, 0, 1 0.2, 0.5, 0.3 0.1 0.49
0, 10 0.9, 0.1 1 9

In the last row, most of the weight sits at 0, but a small chance of 10 pulls the expected value to 1. The average looks modest, yet the variance is large because one outcome lies far from the center. This is a good example of why expected value alone does not capture risk.

Limitations and Assumptions

This calculator is designed for discrete random variables, meaning variables that take on separate countable outcomes such as 0, 1, 2, or a listed set of possible payoffs. It is not intended for continuous distributions like a full normal distribution described by a density curve. If your problem involves continuous probability, you would usually work with integrals or distribution-specific formulas instead of manually entering a small list of points.

The tool also assumes that each row represents a complete outcome category for the same random variable. In other words, probabilities should describe mutually exclusive possibilities from one experiment or decision model. If the rows come from different experiments, overlapping events, or conditional branches that have not been combined correctly, the result may look precise while representing the wrong model.

Automatic normalization is convenient, but it should be interpreted carefully. If your probabilities add to 0.98 because of rounding, normalization is usually harmless and helpful. If they add to 14 because you entered raw frequencies, normalization is also reasonable. But if the numbers are inconsistent because of a modeling mistake, normalization will still force them to behave like probabilities. The calculator cannot tell whether the input reflects a valid real-world setup; it can only compute from what you provide.

A few practical limitations are worth keeping in mind:

  • The form supports up to five pairs, which is enough for many teaching examples but not every large distribution.
  • Blank rows are ignored, but a row only counts if both the value and the probability are present.
  • Probabilities must sum to a positive number after any blank rows are ignored.
  • Variance is reported for the population-style distribution you enter, not as a sample variance estimate from observed data.

These limitations do not reduce the value of the calculator; they simply define its intended use. For quick probability questions, classroom demonstrations, and decision comparisons, the page is an efficient way to connect the formulas to an interpretable result.

Connections and Context

Expected value and variance appear throughout mathematics, economics, engineering, and science. Insurers use expected value to estimate average claim cost and variance to understand how much capital they need for unusually large claims. Investors compare average returns with volatility. Manufacturers track variation to judge whether a process is stable. Even in everyday reasoning, people weigh average payoff against uncertainty when deciding between a safe option and a risky one.

Historically, expectation grew out of gambling problems studied by mathematicians such as Pascal, Fermat, and Huygens. Later, variance became a central tool in modern statistics because averages alone were not enough to describe data or uncertainty. That history helps explain why these two quantities still appear together so often: one tells you where the center is, and the other tells you how much life happens away from that center.

Input rows load below automatically. If they do not appear, refresh the page or enable JavaScript.

Clipboard status messages will appear here after you use Copy Result.

Enter value-probability pairs to compute statistics.

Mini-Game: Balance the Distribution

If you want a fast way to build intuition, try the optional mini-game below. Each round shows a weighted distribution on a number line. Your job is to move the glowing pivot to the spot where the beam would balance and then lock in your answer. In other words, you are aiming for the expected value. As the run continues, the distributions become wider and the beam wobbles more, echoing the idea of higher variance.

Score0
Time78.0s
Streak0
Round0 / 8
Best0

Move your pointer or use the arrow keys to position the pivot. Click, tap, or press Space to lock your estimate.

Balance the Distribution

Set the glowing pivot where the beam should balance. Move with your mouse, finger, or arrow keys, then click, tap, or press Space to lock your answer. Closer guesses score more, and higher-variance rounds sway harder.

Score big by finding the expected value quickly. The true expected value is the balance point; variance changes how dramatic the spread feels around it.

  • Objective: place the pivot at the expected value.
  • Controls: pointer to move, click or tap to lock, arrow keys and Space as keyboard fallback.
  • Challenge: later rounds add more outcomes and stronger variance wobble.

Embed this calculator

Copy and paste the HTML below to add the Expected Value and Variance Calculator | Discrete Probability Mean, Variance, and Standard Deviation to your website.