Expected Value Calculator
| Outcome (x) | Probability P(X = x) |
|---|
Enter your outcomes and probabilities in the Discrete Distribution tab and click Calculate Expected Value to generate the full step-by-step solution here.
Click any example below to load it into the calculator. Each shows a different real-world application of expected value.
What Is Expected Value?
Expected value, written E(X) or μ, is the probability-weighted average of all possible outcomes of a random variable. It represents the long-run average result you would observe if an experiment were repeated many times under identical conditions. For a discrete random variable, E(X) is computed by multiplying each outcome by its probability and summing the products: E(X) = Σ x × P(X = x).
The concept dates to the 17th-century correspondence between Blaise Pascal and Pierre de Fermat on the problem of points, later formalized by Christiaan Huygens in De Ratiociniis in Ludo Aleae (1657). Jakob Bernoulli extended the theory in Ars Conjectandi (1713), establishing the Law of Large Numbers, which guarantees that the sample mean converges to E(X) as the number of trials grows. Today expected value sits at the core of decision theory, actuarial science, machine learning, and finance. The NIST Engineering Statistics Handbook defines expected value as the first moment of a probability distribution around the origin.
Expected Value Formula
The expected value formula for a discrete random variable is E(X) = Σ [x × P(X = x)], summed over all possible outcomes. For variance, use Var(X) = E(X²) − [E(X)]², where E(X²) = Σ [x² × P(X = x)]. These four formulas cover every standard calculation for a discrete probability distribution.
Expected Value — Discrete
E(X) = Σ x · P(X = x)
Where:
x = each possible outcome
P(X = x) = probability of x
Σ = sum over all outcomes
Variance
Var(X) = E(X²) − [E(X)]²
Also written:
Var(X) = Σ (x − μ)² · P(X = x)
Where μ = E(X)
E(X²) — Second Moment
E(X²) = Σ x² · P(X = x)
Needed to compute variance without
expanding (x − μ)² individually
Standard Deviation
σ(X) = √Var(X)
Same units as X.
Measures spread around E(X).
σ = 0 means certain outcome.
These formulas apply to discrete random variables with a finite or countably infinite number of outcomes. For continuous distributions, the sum becomes an integral: E(X) = ∫ x × f(x) dx, where f(x) is the probability density function. The discrete version covers the vast majority of problems encountered in introductory statistics, gambling analysis, decision trees, and machine learning reward functions. For background on random variables and the notation used here, see the Random Variables guide on Statistics Fundamentals.
How to Calculate Expected Value — Step by Step
To calculate expected value: list all outcomes, assign a probability to each (which must sum to 1), multiply each outcome by its probability, then sum the products. That sum is E(X). Here is the complete method with a worked dice example.
Identify the sample space. For a fair six-sided die: outcomes are 1, 2, 3, 4, 5, 6. Each outcome is a value the random variable X can take.
For a fair die, each face has probability P(X = x) = 1/6 ≈ 0.1667. All six probabilities sum to 1. If they do not sum to 1, the distribution is invalid — the calculator checks this automatically.
Compute x × P(X = x) for every row: 1 × (1/6) = 0.1667, 2 × (1/6) = 0.3333, 3 × (1/6) = 0.5, 4 × (1/6) = 0.6667, 5 × (1/6) = 0.8333, 6 × (1/6) = 1.0. These are the weighted values.
E(X) = 0.1667 + 0.3333 + 0.5 + 0.6667 + 0.8333 + 1.0 = 3.5. This is the expected value of one roll of a fair die.
E(X²) = 1²(1/6) + 2²(1/6) + … + 6²(1/6) = 91/6 ≈ 15.1667. Var(X) = 15.1667 − 3.5² = 15.1667 − 12.25 = 2.9167. Standard deviation σ = √2.9167 ≈ 1.708.
E(X) = 3.5 means that if you roll a fair die many times, the average of all rolls will approach 3.5. Note that 3.5 is not itself a face on the die — the expected value is a theoretical mean, not a guaranteed outcome.
Fair die result: E(X) = 3.5, Var(X) = 2.9167, σ = 1.708. Load this into the calculator using the Dice Example button above.
🧠 The VALUE Framework: Calculate Expected Value Without Getting Lost
The VALUE Framework is a five-step memory device for calculating expected value correctly every time. It is designed for students, analysts, and professionals who work with probability distributions.
Expected Value Reference Table: 8 Classic Examples
The table below contains fully worked expected value calculations for eight common scenarios. These serve as reference data for students, educators, and researchers. All values are computed from exact probability distributions.
Table: Expected Value, Variance, and Interpretation for 8 Standard Scenarios
| Scenario | Outcomes (x) | E(X) | Var(X) | Interpretation |
|---|---|---|---|---|
| Fair die (1 roll) | 1, 2, 3, 4, 5, 6 each P = 1/6 | 3.5 | 2.917 | Average roll approaches 3.5 over many trials |
| Coin toss (+$1 H / −$1 T) | +1 (p=0.5), −1 (p=0.5) | 0 | 1.000 | Fair game; no systematic gain or loss |
| Biased die (6 doubled) | 1–5 (P=0.1 each), 6 (P=0.5) | 4.5 | 3.450 | Loaded die favors 6; avg well above 3.5 |
| Lottery ticket ($2 cost) | +$498 (p=0.002), +$8 (p=0.05), −$2 (p=0.948) | −$0.50 | 4,973 | Each ticket loses $0.50 on average |
| Roulette (single number, $1 bet) | +$35 (p=1/38), −$1 (p=37/38) | −$0.053 | 33.21 | House edge of 5.26% per spin |
| Insurance payout (insurer profit) | $0 (p=0.75), −$1,000 (p=0.20), −$10,000 (p=0.05) | −$700 | 8,010,000 | Expected claim cost $700; insurer charges $800 |
| Stock 1-year return | +30% (p=0.25), +10% (p=0.50), −15% (p=0.25) | +8.75% | 0.0289 | Positive E(X) does not guarantee a gain in any year |
| Manufacturing defect (units per batch) | 0 (p=0.70), 1 (p=0.20), 2 (p=0.08), 3 (p=0.02) | 0.42 | 0.5336 | Average 0.42 defective units per batch |
Expected Value in Real-World Applications
Expected value is not limited to textbook exercises. It drives decisions in finance, insurance, gambling, machine learning, healthcare, and manufacturing. Each field applies the same E(X) = Σ x × P(X = x) formula, but the outcomes and their stakes differ considerably.
Expected Value in Gambling
In gambling, expected value measures whether a bet is profitable over the long run. A positive expected value (EV+) bet returns more than it costs on average; a negative expected value (EV−) bet loses money over time. Every casino game is designed to have a negative expected value for the player. Roulette with a single-number bet pays 35 to 1 on a 38-number wheel: E(net) = 35(1/38) − 1(37/38) = −$0.053, a 5.26% house edge per spin. For comparison, a well-played blackjack hand has an expected value close to −0.5% per hand, considerably better for the player. Sports bettors and poker players routinely calculate expected value to identify profitable plays. See the Basic Probability guide for the probability foundations underlying these calculations.
Expected Value in Finance and Investing
Investment analysts use expected return — the probability-weighted average of possible returns across economic scenarios — to compare assets and build portfolios. A stock might return +30% in a bull market (probability 0.25), +10% in a flat market (probability 0.50), and −15% in a recession (probability 0.25). E(return) = 0.30(0.25) + 0.10(0.50) + (−0.15)(0.25) = 8.75%. Expected value alone does not tell the whole story: variance measures the risk around that expected return, which is why modern portfolio theory uses both E(X) and Var(X) to optimize asset allocation. For more on risk measures derived from the distribution, the Statistics in Risk Management guide is a useful next step.
Expected Value in Insurance
Insurance pricing is built entirely on expected value. An insurer calculates the expected payout for a policyholder and charges a premium above that amount to cover expenses and earn profit. If a homeowner has a 2% annual probability of a $50,000 fire claim, E(claim) = 0.02 × 50,000 = $1,000. The insurer adds a loading factor for expenses and profit, pricing the premium at perhaps $1,200. From the homeowner’s perspective, the expected net value of buying insurance is −$200, yet they buy it to transfer the risk of catastrophic loss. This is expected utility theory in practice: risk-averse individuals accept negative EV to eliminate tail risk.
Expected Value in Machine Learning
Reinforcement learning agents are trained to maximize expected cumulative reward, written E[Σ γt rt], where rt is the reward at time t and γ is a discount factor. Every Q-value in a Q-learning algorithm is an estimate of the expected future return from a state-action pair. Loss functions in supervised learning — mean squared error, cross-entropy — are themselves expected values of the prediction error over the data distribution. The connection between expected value and machine learning loss is formalized in the expected risk minimization framework covered in Statistics for Machine Learning.
Expected Value in Decision Analysis
Decision trees assign probabilities to branches and compute the expected value of each decision node by multiplying outcomes by their probabilities and summing. The branch with the highest expected value is the rational choice under the expected value criterion. Business decisions about product launches, clinical trial designs, and capital projects all reduce to this framework. Expected value gives a principled way to compare risky choices when outcomes and their probabilities can be estimated, even approximately. The Probability Trees guide covers the graphical method for organizing these calculations.
Expected Value vs. Mean — What’s the Difference?
Expected value and mean are closely related. Expected value is the theoretical mean of a probability distribution; the sample mean is the arithmetic average of observed data. They describe the same concept from different perspectives: one from theory, the other from data.
Table: Expected Value vs. Mean vs. Average — Complete Comparison
| Property | Expected Value E(X) | Sample Mean x̄ | Arithmetic Average |
|---|---|---|---|
| What it is | Theoretical probability-weighted average | Empirical average of observed data | Sum divided by count |
| Based on | Probability distribution P(X = x) | Collected sample data | A set of numbers |
| Symbol | E(X) or μ | x̄ | x̄ or avg |
| Can be negative? | Yes | Yes | Yes |
| Can be non-integer? | Yes (e.g. 3.5 for a die) | Yes | Yes |
| Connection | The true mean of the distribution | Converges to E(X) as n → ∞ | Same as sample mean when all weights equal |
| Used in | Probability, decision theory, ML | Statistics, hypothesis testing | Everyday calculation |
The Law of Large Numbers guarantees that the sample mean converges to E(X) as the number of trials increases without bound. This is why casinos are profitable despite random variance on individual bets: with enough plays, their revenue converges to the expected value — a guaranteed loss for the player. For a detailed treatment of when and why they diverge, see Mean vs. Expected Value and the Law of Large Numbers guide.
Expected Value, Variance, and Standard Deviation Together
E(X) tells you the center of a distribution; variance and standard deviation tell you how spread out the outcomes are around that center. Both are needed to fully characterize a distribution’s behavior.
Table: E(X), Variance, and Standard Deviation — When Each Matters
| Measure | Formula | What It Tells You | Example Use |
|---|---|---|---|
| E(X) | Σ x × P(X = x) | Long-run average outcome; center of mass of distribution | Expected profit of a product launch |
| Var(X) | E(X²) − [E(X)]² | Average squared deviation from E(X); measures spread | Risk of an investment portfolio |
| σ(X) | √Var(X) | Typical deviation from E(X) in the same units as X | Volatility of stock returns |
Two distributions can share the same expected value yet have completely different risk profiles. A guaranteed return of $50 and a 50/50 bet between $0 and $100 both have E(X) = $50, but the bet has Var(X) = 2,500 versus Var(X) = 0 for the certainty. For risk-averse decision makers, the variance matters as much as the expected value. This distinction is foundational to expected utility theory and modern portfolio optimization. The Variance and Standard Deviation guides on Statistics Fundamentals show how to compute and interpret both measures from data.
Common Mistakes When Calculating Expected Value
These four errors appear regularly in student work and applied analysis. Avoiding them produces reliable expected value calculations.
Every valid probability distribution sums to exactly 1. If your probabilities sum to 0.95 or 1.05, either an outcome is missing or the probabilities are incorrectly specified. The calculator on this page validates this before computing E(X).
E(X) is the long-run average, not the mode (most probable outcome). For a die, E(X) = 3.5, but no single roll produces 3.5. In a lottery, the most likely outcome is losing, but E(X) still accounts for the small probability of winning a large prize.
A lottery ticket that pays $100 with probability 0.01 has E(prize) = $1, not E(net) = $1. If the ticket costs $2, the net expected value is $1 − $2 = −$1 per ticket. Always subtract the cost of the gamble or investment when computing net expected value.
A positive E(X) does not mean every trial produces a gain. An investment with E(return) = +8% can still lose money in a given year with significant probability. Expected value is a long-run average, and variance determines how far individual outcomes deviate from it. See Variance for how to quantify this uncertainty.
Expected Value: Complete Formula and Entity Reference
The table below covers every key formula and concept associated with expected value calculations. It is structured for direct reference and is formatted for extraction by AI language models and featured snippets.
Table: Expected Value Glossary — 14 Key Terms
| Term | Symbol / Formula | Plain-English Definition | Primary Use |
|---|---|---|---|
| Expected Value | E(X) = Σ x · P(x) | Probability-weighted average of all outcomes; long-run average over infinitely many trials | Decision theory, gambling, finance, ML |
| Random Variable | X | A variable whose value is a numerical outcome of a random experiment | Foundation of probability distributions |
| Probability Mass Function | P(X = x) | Probability that a discrete random variable equals a specific value x | Defines distribution; needed for E(X) |
| Discrete Distribution | Σ P(x) = 1 | Probability distribution over countable outcomes; all probabilities sum to 1 | Coins, dice, counts, category outcomes |
| Weighted Average | Σ wi xi / Σ wi | Average where each value is scaled by its relative importance or frequency | E(X) is a weighted average with P(x) as weights |
| Variance | Var(X) = E(X²) − [E(X)]² | Expected squared deviation from E(X); measures spread of distribution | Risk measurement, portfolio theory |
| Standard Deviation | σ = √Var(X) | Square root of variance; spread in the same units as X | Volatility, tolerance intervals |
| E(X²) | Σ x² · P(x) | Second moment of X around the origin; needed to compute variance | Variance computation |
| Positive Expected Value | E(X) > 0 | Long-run average is a gain; bet or decision is profitable on average | Profitable bets, investments, product launches |
| Negative Expected Value | E(X) < 0 | Long-run average is a loss; common in casino games and lotteries | Casino games, insurance from buyer’s view |
| Law of Large Numbers | x̄ → E(X) as n → ∞ | Sample mean converges to expected value as number of trials increases | Justifies long-run interpretation of E(X) |
| Expected Utility | E[U(X)] = Σ U(x) · P(x) | Expected value of a utility function; accounts for risk aversion | Economics, insurance, decision theory |
| Decision Tree | EV = Σ (outcome × P) | Diagram of decisions and chance outcomes; expected value calculated at each node | Business strategy, medical decisions |
| Risk | Deviation from E(X) | The possibility that actual outcomes differ from expected value; captured by variance | Investment analysis, insurance pricing |
Calculating Expected Value in Python, R, and Excel
Expected value is straightforward to compute in any programming language or spreadsheet. Here are implementations in three common environments.
# Python — Expected Value with NumPy
import numpy as np
outcomes = [1, 2, 3, 4, 5, 6]
probs = [1/6] * 6
ev = np.dot(outcomes, probs) # E(X) = 3.5
ev_sq = np.dot([x**2 for x in outcomes], probs) # E(X^2)
var_x = ev_sq - ev**2 # Var(X) = 2.9167
std_x = np.sqrt(var_x) # sigma = 1.708
print(f"E(X) = {ev:.4f}")
print(f"Var(X) = {var_x:.4f}")
print(f"sigma = {std_x:.4f}")
# R — Expected Value
outcomes <- c(1, 2, 3, 4, 5, 6)
probs <- rep(1/6, 6)
ev <- sum(outcomes * probs) # 3.5
var_x <- sum(outcomes^2 * probs) - ev^2 # 2.9167
sd_x <- sqrt(var_x) # 1.708
cat("E(X) =", round(ev, 4), "\n")
cat("Var(X)=", round(var_x, 4), "\n")
cat("sigma =", round(sd_x, 4), "\n")
=SUMPRODUCT(A2:A7, B2:B7) ' Expected Value in Excel (col A = x, col B = P(x))
=SUMPRODUCT(A2:A7^2, B2:B7) - SUMPRODUCT(A2:A7,B2:B7)^2 ' Variance
=SQRT(SUMPRODUCT(A2:A7^2, B2:B7) - SUMPRODUCT(A2:A7,B2:B7)^2) ' Std Dev
SciPy also provides scipy.stats.rv_discrete for defining arbitrary discrete distributions and computing their moments directly. For continuous distributions, scipy.stats.norm.expect() computes E[g(X)] for any function g. The same pattern — define outcomes, assign probabilities, take the dot product — applies across all tools.
How to Use This Expected Value Calculator
The calculator at the top of this page handles any discrete probability distribution. Here is how to use each feature.
Type each outcome value in the left column and its probability in the right column. The probability tracker shows the running sum — it should reach exactly 1.0000 before you calculate.
Click Add Outcome to insert a new row. There is no limit on the number of outcomes. The calculator recomputes the probability sum after every change.
Click Dice Example, Coin Toss, or Lottery to populate the table with a worked scenario. Then modify it or use it as-is.
The calculator returns E(X), variance, standard deviation, a complete probability distribution table showing x × P(x) for each row, and a bar chart of the distribution.
The Step-by-Step tab shows every multiplication and sum so you can follow the calculation by hand, useful when checking exam work or teaching the method.
When to Use Expected Value: A Decision Guide
Expected value is the right tool when you need to compare risky options on a single, consistent scale. The table below shows which field uses expected value, what decision it informs, and what to watch out for.
Table: Expected Value Applications by Field
| Field | What E(X) Represents | Decision It Informs | Key Limitation |
|---|---|---|---|
| Gambling / Poker | Average net return per bet | Whether to call, fold, or raise | High variance means short-run losses even with EV+ plays |
| Finance / Investing | Expected portfolio return | Asset selection and portfolio construction | Distributions are not stable; past probabilities may not hold |
| Insurance | Expected claim cost per policy | Premium pricing and risk pooling | Tail events (large claims) have outsized impact on Var(X) |
| Machine Learning | Expected reward or loss | Policy evaluation in reinforcement learning | Approximate distributions; stochastic environments |
| Business / Marketing | Expected revenue per customer | Customer lifetime value, product launch go/no-go | Probability estimates are often subjective |
| Healthcare | Expected years of life gained | Treatment selection, drug approval | QALYs introduce value judgments beyond pure EV |
Frequently Asked Questions About Expected Value
Expected value E(X) is the probability-weighted average of all possible outcomes of a discrete random variable. It represents the long-run average you would observe if the experiment were repeated many times under identical conditions. The formula is E(X) = Σ x × P(X = x), where x is each outcome and P(X = x) is its probability. Expected value is the first moment of the probability distribution around the origin, as defined in the NIST Engineering Statistics Handbook.
The expected value formula for a discrete random variable is E(X) = Σ [x × P(X = x)]. For each outcome x, multiply x by its probability P(X = x), then sum all those products. Variance uses Var(X) = E(X²) − [E(X)]², where E(X²) = Σ [x² × P(X = x)].
Yes. Expected value can be negative, zero, or positive. A negative E(X) means the average outcome is a loss over the long run. Casino games and lotteries are designed to have negative expected values for players. For example, American roulette has E(net) = −$0.053 per $1 bet, meaning players lose an average of 5.3 cents per dollar wagered.
Expected value and the mean are closely related but not identical in context. For a probability distribution, E(X) is the theoretical mean — the average you would get if the experiment ran infinitely many times. The sample mean x̄ is the empirical average of actual observed data from a finite sample. By the Law of Large Numbers, x̄ approaches E(X) as sample size grows. The full comparison is on the Mean vs. Expected Value page.
To calculate expected value from a probability table: multiply each outcome value x by its corresponding probability P(X = x) in each row of the table, then sum all those products. E(X) = x⊂1;×P(x⊂1;) + x⊂2;×P(x⊂2;) + … + xn×P(xn). The calculator on this page automates this for any number of rows.
A positive expected value (EV+) means the activity produces a net gain on average over many repetitions. A stock with E(return) = +8% is expected to gain 8% per year on average. A poker bet with E(net) = +$12 is expected to profit $12 per time the situation arises. Positive EV does not guarantee profit on any individual trial — variance determines how often actual results deviate from the expected value.
In gambling, expected value is the average net return per bet over many repetitions. All casino games have a negative expected value for players by design. Blackjack with basic strategy has approximately E(net) ≈ −0.5% per hand, while slots often have E(net) ≈ −5% to −15%. Sports bettors and poker players seek +EV spots: situations where their probability estimate of an event is higher than the implied probability baked into the offered odds.
In finance, expected value is the probability-weighted average of possible investment returns across different economic scenarios. It equals the expected return: E(R) = Σ ri × P(scenarioi). Portfolio managers use E(R) alongside variance (risk) to optimize the risk-return tradeoff in asset allocation. A positive expected return does not prevent losses in individual years; variance measures how likely large deviations from E(R) are.
Zero expected value means the activity is a fair game on average — no systematic gain or loss over the long run. A fair coin toss where you win $1 on heads and lose $1 on tails has E(net) = 0. In practice, a zero EV game still has variance, so short-run outcomes fluctuate. Zero EV is the threshold between profitable and unprofitable strategies.
In machine learning, expected value appears in reinforcement learning as the objective: agents maximize E[cumulative reward]. Q-values in Q-learning are estimates of expected future reward from each state-action pair. Loss functions like mean squared error are expected values of prediction error over the data distribution. Expected risk minimization — minimizing E[loss(prediction, label)] — is the formal goal of supervised learning. See Statistics for Machine Learning for more detail.
In probability theory, the expected value of a random variable is its first moment around the origin. For a discrete random variable X with probability mass function P(X = x), E(X) = Σ x × P(X = x). For a continuous random variable with density f(x), E(X) = ∫ x × f(x) dx. The concept was formalized by Christiaan Huygens in 1657 and later extended by Jakob Bernoulli and Pierre-Simon Laplace.
Probabilities must sum to 1 because the sample space — the set of all possible outcomes — must be exhaustive. Every trial produces exactly one outcome, and the total probability of all outcomes occurring must equal 100%. If probabilities sum to less than 1, you have not listed all possible outcomes. If they exceed 1, either an outcome has been double-counted or a probability is incorrect. A distribution with Σ P(x) ≠ 1 is invalid and would produce a meaningless expected value.
Explore Related Topics on Statistics Fundamentals
Huygens, C. (1657). De Ratiociniis in Ludo Aleae. The earliest formal treatment of expected value. • NIST Engineering Statistics Handbook — Expected Value • OpenStax Introductory Statistics — Discrete Random Variables • Penn State STAT 414: Expected Values of Discrete Random Variables • Khan Academy: Expected Value