Skip to main content
v2026.11,858 entries · CC-BY 4.0

Expected Value Formula: E(X) = Σ x·P(x) With Worked Examples

The expected value formula E(X) = Σ x·P(x) multiplies each value by its probability and adds the results. Worked examples and Excel, R, Python code.

Written and maintained by CASRAI Editorial Board

Last updated

The expected value formula for a discrete random variable is E(X) = Σ x · P(x): multiply each possible value by its probability, then add the products. The result is the long-run average of the variable, not a promise about any single outcome. This guide gives the formula symbol by symbol, three worked examples with the arithmetic shown, a reading guide for the result, and short Excel, R and Python snippets.

What Is Expected Value? A Definition in One Paragraph

Expected value is the probability-weighted average of all the values a random variable can take. OpenStax Introductory Statistics 2e describes it as often referred to as the “long-term” average or mean: if you could repeat the same random process many times, the average of the results would settle near the expected value. It is a property of the probability model (a population or theoretical quantity), whereas a sample mean is a property of the data you actually collected. The two are linked by the law of large numbers.

The Expected Value Formula, Symbol by Symbol

For a discrete random variable, the textbook form is E(X) = Σ x f(x), where the sum runs over every value x the variable can take (Siegrist, Probability, Mathematical Statistics, and Stochastic Processes). OpenStax writes the same quantity as μ = Σ x · P(x).

  • X is the random variable, the quantity whose long-run average you want.
  • x is one specific value X can take.
  • P(x) (or f(x), the probability mass function) is the probability that X equals x.
  • Σ means “add up”, over all possible values of x.
  • E(X) and μ are two names for the result.

Siegrist adds that the sum must be well defined. For a variable with finitely many values that is automatic; for infinitely many values the sum has to converge.

Expected Value Examples With the Arithmetic Shown

Example 1: days a soccer team plays per week

This is Example 4.3 in OpenStax. A team plays 0 days with probability 0.2, 1 day with probability 0.5 and 2 days with probability 0.3. The probabilities add to 0.2 + 0.5 + 0.3 = 1, as they must.

E(X) = (0)(0.2) + (1)(0.5) + (2)(0.3) = 0 + 0.5 + 0.6 = 1.1 days per week in the long run.

Example 2: one roll of a fair die

Each face from 1 to 6 has probability 1/6.

E(X) = (1+2+3+4+5+6)(1/6) = 21/6 = 3.5.

No roll can show 3.5. The expected value does not have to be a value the variable can actually take.

Example 3: the sum of two fair dice

Let Y = X1 + X2, the total of two fair dice. Expected value is linear: E(X + Y) = E(X) + E(Y), and more generally E(Σ aiXi) = Σ aiE(Xi) (Siegrist). So E(Y) = 3.5 + 3.5 = 7, which matches Siegrist’s worked result. Linearity saves you from listing all 36 outcomes, and it holds whether or not the two variables are independent.

Example 4: a bet (illustrative numbers)

A ticket costs 2 and pays 100 with probability 0.01, otherwise nothing. The expected payout is (100)(0.01) + (0)(0.99) = 1. The expected net result is (98)(0.01) + (−2)(0.99) = 0.98 − 1.98 = −1 per ticket. The figures are invented for illustration; the method is the formula above.

Interpreting the Result

What you see How to read it
E(X) = 1.1 for the soccer example The long-run average over many weeks, not the number of days in any one week.
E(X) = 3.5 for a die A legitimate expected value that is not an attainable outcome.
Observed average differs from E(X) after few trials Expected. As the number of trials grows, the gap between the theoretical probability and the relative frequency approaches zero (law of large numbers; OpenStax cites Pearson’s 24,000 coin tosses with 12,012 heads).
E(X + Y) for two variables Equals E(X) + E(Y); no independence is needed for this rule.

Expected value tells you where the average sits, not how spread out the outcomes are. For spread, pair it with the standard deviation. For the broader family of summary measures, see descriptive statistics and the term entry on descriptive versus inferential statistics.

Assumptions and Common Mistakes

  • Probabilities must sum to 1. Check this before multiplying. A table that sums to 0.9 or 1.1 has an error.
  • Every possible value must be listed. Leaving out a value drops its x · P(x) term from the sum.
  • Expected value is not the most likely outcome. The die has an expected value of 3.5 and no most likely face at all.
  • Do not confuse E(X) with a sample mean. E(X) comes from the probability model; a sample mean comes from observed data and varies from sample to sample.
  • Check the sum is well defined when a variable has infinitely many possible values.
  • Averaging the values without weights (here (0+1+2)/3 = 1) gives the wrong answer unless every value is equally likely.

When expected value is used to compare decisions under uncertainty in health economics, see expected value of perfect information, which builds on the basic quantity defined here.

How to Report an Expected Value (APA-Style Example)

The University of Washington Psychology Writing Center’s handout on reporting statistical results says that statistical symbols that are not Greek letters are italicized (M, SD, N, t, p) and its examples write the symbol, a space, an equals sign, a space and then the value (for example M = 121, SD = 14.2). Greek letters such as μ are not italicized. Following that convention, a theoretical expected value and its calculation can be written:

The expected number of days played per week was μ = 1.1, computed as the sum of each value multiplied by its probability (0 × .20 + 1 × .50 + 2 × .30).

An observed sample mean is reported differently, with M and SD and the sample size N stated, because it is a data summary and not the model’s expected value. State clearly which one you mean.

How to Calculate Expected Value in Excel, R or Python

All three snippets use the soccer example (values 0, 1, 2 with probabilities 0.2, 0.5, 0.3) and return 1.1.

Excel

Put the values in A2:A4 and the probabilities in B2:B4, then:

=SUMPRODUCT(A2:A4, B2:B4)

R

x <- c(0, 1, 2)p <- c(0.2, 0.5, 0.3)stopifnot(isTRUE(all.equal(sum(p), 1)))sum(x * p)   # 1.1

Python

x = [0, 1, 2]p = [0.2, 0.5, 0.3]assert abs(sum(p) - 1) < 1e-9print(sum(xi * pi for xi, pi in zip(x, p)))   # 1.1

The check on the probabilities is deliberate: the formula silently gives a wrong answer if they do not add to 1.

Expected Value Formula FAQ

What is expected value?

Expected value is the probability-weighted average of the values a random variable can take, often called the long-term average or mean. For a discrete variable it is E(X) = Σ x · P(x).

What is the formula for expected value?

Multiply each possible value by its probability and add the results: E(X) = Σ x · P(x). For a sum of random variables, add their expected values: E(X + Y) = E(X) + E(Y).

Can an expected value be a number the variable never takes?

Yes. A fair die has an expected value of 3.5 although no roll shows 3.5.

Is expected value the same as the mean?

For a random variable, expected value is the mean of its distribution. A sample mean is calculated from observed data and approaches the expected value as the number of trials grows.

Sources

  • OpenStax, Introductory Statistics 2e, section 4.2 “Mean or Expected Value and Standard Deviation”: openstax.org (read 2026-10-29).
  • Siegrist, K., Probability, Mathematical Statistics, and Stochastic Processes, section 4.1 “Definitions and Basic Properties” (LibreTexts): stats.libretexts.org (read 2026-10-29).
  • University of Washington Psychology Writing Center, “Reporting Results of Common Statistical Tests in APA Format”: psych.uw.edu (read 2026-10-29).

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Expected Value Formula: E(X) = Σ x·P(x) With Worked Examples

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →

Ask CASRAI · Regulatory Radar

Research-admin question? Get an answer that links its sources.

An AI assistant specialized in research administration. Every answer links its sources to check before you act. 2 questions free, no account. $29/month after.

  • Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.
  • Every answer numbers its sources and links each one, so you can check the source yourself.