Bookmarks    
nPr and nCr    
Random Number    
SD Calculator    
Sample Size    
Percent Error    
Density    
Molarity    
Molar Mass    
Ohm's Law    
Watts to Amps    
Voltage Drop    
Long Division    
Mixed Numbers    
Rounding    
Nth Root    
Exponents    
Half-Life    
Polar Form    
De Moivre    
3D Distance    
Point to Line    
Cross Product    
Determinant    
Sin Cos Tan    
Triangle Area    
Scale Factor    
Sector Area    
Ellipse Area    
Cube Volume    
Box Volume    
Sphere Volume    
Cone Volume    
Pipe Volume    
Time Duration    
Time Card    
Present Value    
Future Value    
Churn Rate    
A/B Test Calc    
SEO Traffic    
Ideal Weight    
Fat Intake    
Child Height    
Golf Handicap    
Heat Index    
Wind Chill    
Dew Point    
Download Time    
kWh to Cost    
AC Size (BTU)    
Heating Costs    
LED Savings    
Trip Gas Cost    
Tire Size    
Solar Output    
Solar Payback    
Battery Size    
Wall Area    
Gravel Needed    
Mortar Mix    
Slope Grade    
Curtain Size    
Soil Needed    
Sod Needed    
Ramp Length    
Blind Size    
Drain Slope    
Board Feet    
Heat Loss    
Furniture Fit    
Moving Boxes    
Plywood Cuts    
Shelf Sag    
   Add
Probability and random number calculators
Independent Events
Independent Events
Two Events Solver
Two Events Solver
Repeated Trials
Repeated Trials
Bayes' Theorem
Bayes' Theorem
Expected Value
Expected Value
Binomial Distribution
Binomial Distribution
nPr and nCr
nPr and nCr
Circular Permutation
Circular Permutation
With Repetition
With Repetition
Random Number
Random Number
Averages and statistics calculators
Average Calculator
Average Calculator
Mean Median Mode
Mean Median Mode
SD Calculator
SD Calculator
Quartiles & IQR
Quartiles & IQR
Frequency Table
Frequency Table
Correlation (r)
Correlation (r)
Normal Probability
Normal Probability
Z-Score Calculator
Z-Score Calculator
Confidence Interval
Confidence Interval
Sample Size
Sample Size
Mark & Recapture
Mark & Recapture
P-Value Calculator
P-Value Calculator
Percentage and ratio calculators
Percentage Calc
Percentage Calc
Percent Change
Percent Change
Percent Difference
Percent Difference
Percent Error
Percent Error
Ratio Calculator
Ratio Calculator
Discount Calculator
Discount Calculator
Sales Tax Calculator
Sales Tax Calculator
Margin Calculator
Margin Calculator
Speed calculators
Speed Calculator
Speed Calculator
Density and concentration calculators
Density
Density
Molarity
Molarity
Molar Mass
Molar Mass
Physics and electricity calculators
Ohm's Law
Ohm's Law
Watts to Amps
Watts to Amps
Resistor Colors
Resistor Colors
Voltage Drop
Voltage Drop
Unit conversion calculators
Weight Converter
Weight Converter
Shoe Size Converter
Shoe Size Converter
Integer and signed number calculators
Long Division
Long Division
LCM Calculator
LCM Calculator
GCF Calculator
GCF Calculator
Integer Calculator
Integer Calculator
Prime Factorization
Prime Factorization
Diophantine Solver
Diophantine Solver
Modulo Calculator
Modulo Calculator
Factor Calculator
Factor Calculator
Roman Numerals
Roman Numerals
Fraction, decimal and rounding calculators
Fraction Calculator
Fraction Calculator
Mixed Numbers
Mixed Numbers
Simplify Fractions
Simplify Fractions
Fraction to Decimal
Fraction to Decimal
Decimal to Fraction
Decimal to Fraction
Rounding
Rounding
Equation and inequality calculators
Linear Equation
Linear Equation
Linear Systems
Linear Systems
Quadratic Formula
Quadratic Formula
Absolute Value
Absolute Value
Quadratic Inequality
Quadratic Inequality
Polynomial calculators
Binomial Theorem
Binomial Theorem
Square root and nth root calculators
Simplify Radicals
Simplify Radicals
Nth Root
Nth Root
Exponent and logarithm calculators
Exponents
Exponents
Log Calculator
Log Calculator
Number of Digits
Number of Digits
Scientific Notation
Scientific Notation
Sci. Notation Math
Sci. Notation Math
Half-Life
Half-Life
Complex number calculators
Complex Numbers
Complex Numbers
Polar Form
Polar Form
De Moivre
De Moivre
Function and graph calculators
Slope Calculator
Slope Calculator
Linear Function
Linear Function
Direct & Inverse Variation
Direct & Inverse Variation
y = ax² Calculator
y = ax² Calculator
Distance Formula
Distance Formula
3D Distance
3D Distance
Section Formula
Section Formula
Point to Line
Point to Line
Lat/Long Distance
Lat/Long Distance
Complete the Square
Complete the Square
Circle Equation
Circle Equation
Conic Sections
Conic Sections
Polar Coordinates
Polar Coordinates
Sequence calculators
Arithmetic Sequence
Arithmetic Sequence
Geometric Sequence
Geometric Sequence
Fibonacci Sequence
Fibonacci Sequence
Recurrence Relation
Recurrence Relation
Vector calculators
Vector Calculator
Vector Calculator
Cross Product
Cross Product
Matrix calculators
Matrix Calculator
Matrix Calculator
Determinant
Determinant
Inverse Matrix
Inverse Matrix
Plane geometry calculators
Sin Cos Tan
Sin Cos Tan
Degrees ⇔ Radians
Degrees ⇔ Radians
a sin θ + b cos θ
a sin θ + b cos θ
Triangle Solver
Triangle Solver
Triangle Area
Triangle Area
Right Triangle
Right Triangle
Pythagorean Theorem
Pythagorean Theorem
Polygon Angles
Polygon Angles
Scale Factor
Scale Factor
Parallel Lines
Parallel Lines
Rectangle Area
Rectangle Area
Parallelogram Area
Parallelogram Area
Trapezoid Area
Trapezoid Area
Circle Calculator
Circle Calculator
Sector Area
Sector Area
Inscribed Angle
Inscribed Angle
Ellipse Area
Ellipse Area
Solid geometry calculators
Cube Volume
Cube Volume
Cube Surface Area
Cube Surface Area
Box Volume
Box Volume
Box Surface Area
Box Surface Area
Cylinder Volume
Cylinder Volume
Cylinder Surface
Cylinder Surface
Sphere Volume
Sphere Volume
Sphere Surface
Sphere Surface
Spherical Cap Volume
Spherical Cap Volume
Cap Surface Area
Cap Surface Area
Ellipsoid Volume
Ellipsoid Volume
Ellipsoid Surface
Ellipsoid Surface
Pyramid Volume
Pyramid Volume
Pyramid Surface
Pyramid Surface
Cone Volume
Cone Volume
Cone Surface Area
Cone Surface Area
Frustum Volume
Frustum Volume
Frustum Surface Area
Frustum Surface Area
Pipe Volume
Pipe Volume
Capsule Volume
Capsule Volume
Capsule Surface Area
Capsule Surface Area
Date and time calculators
Age Calculator
Age Calculator
Days Between Dates
Days Between Dates
Date Calculator
Date Calculator
Hours From Now
Hours From Now
Day of the Week
Day of the Week
Time Calculator
Time Calculator
Time Zone Converter
Time Zone Converter
Hours Calculator
Hours Calculator
Time Duration
Time Duration
Time Card
Time Card
Finance and economics calculators
Compound Interest
Compound Interest
Simple Interest
Simple Interest
Interest Calculator
Interest Calculator
TVM Calculator
TVM Calculator
Present Value
Present Value
Future Value
Future Value
ROI Calculator
ROI Calculator
IRR Calculator
IRR Calculator
Payback Period
Payback Period
Average Return
Average Return
GDP Calculator
GDP Calculator
Web marketing and ad metric calculators
CTR Calculator
CTR Calculator
Conversion Rate
Conversion Rate
CPC, CPM & CPA
CPC, CPM & CPA
ROAS Calculator
ROAS Calculator
Break-Even CPA
Break-Even CPA
LTV Calculator
LTV Calculator
CAC Calculator
CAC Calculator
Churn Rate
Churn Rate
A/B Test Calc
A/B Test Calc
A/B Sample Size
A/B Sample Size
SEO Traffic
SEO Traffic
Break-Even Point
Break-Even Point
Markup vs. Margin
Markup vs. Margin
CAGR Calculator
CAGR Calculator
Health and fitness calculators
BMI Calculator
BMI Calculator
Sleep Calculator
Sleep Calculator
Calorie Calculator
Calorie Calculator
BMR Calculator
BMR Calculator
TDEE Calculator
TDEE Calculator
Ideal Weight
Ideal Weight
Body Fat Calculator
Body Fat Calculator
Lean Body Mass
Lean Body Mass
Calories Burned
Calories Burned
Protein Intake
Protein Intake
Macro Calculator
Macro Calculator
Carb Calculator
Carb Calculator
Fat Intake
Fat Intake
Child Height
Child Height
Sports calculators
Golf Handicap
Golf Handicap
Pace Calculator
Pace Calculator
1RM Calculator
1RM Calculator
Target Heart Rate
Target Heart Rate
Weather calculators
Heat Index
Heat Index
Wind Chill
Wind Chill
Dew Point
Dew Point
Computer calculators
Base Converter
Base Converter
Subnet Calculator
Subnet Calculator
Download Time
Download Time
Household energy and budget calculators
Electricity Cost
Electricity Cost
kWh to Cost
kWh to Cost
Yearly kWh to Cost
Yearly kWh to Cost
AC Size (BTU)
AC Size (BTU)
AC Running Cost
AC Running Cost
Heating Costs
Heating Costs
Gas vs Electric
Gas vs Electric
LED Savings
LED Savings
Salary Calculator
Salary Calculator
Budget Calculator
Budget Calculator
Car calculators
Trip Gas Cost
Trip Gas Cost
EV Charging Cost
EV Charging Cost
EV vs Gas Cost
EV vs Gas Cost
MPG Calculator
MPG Calculator
Tire Size
Tire Size
Solar power and battery calculators
Solar Output
Solar Output
Solar Panel Count
Solar Panel Count
Solar Payback
Solar Payback
Battery Size
Battery Size
Home and DIY calculators
Tile Calculator
Tile Calculator
Stair Calculator
Stair Calculator
Concrete Volume
Concrete Volume
Wall Area
Wall Area
Wallpaper Rolls
Wallpaper Rolls
Paint Calculator
Paint Calculator
Flooring Needed
Flooring Needed
Exterior Walls
Exterior Walls
Gravel Needed
Gravel Needed
Mortar Mix
Mortar Mix
Slope Grade
Slope Grade
Lumber Cut List
Lumber Cut List
Lot Coverage/FAR
Lot Coverage/FAR
Sheet Vinyl Roll
Sheet Vinyl Roll
Insulation Needed
Insulation Needed
Curtain Size
Curtain Size
TV Size & Distance
TV Size & Distance
Soil Needed
Soil Needed
Sod Needed
Sod Needed
Block Calculator
Block Calculator
Brick Calculator
Brick Calculator
Deck Materials
Deck Materials
Ramp Length
Ramp Length
Pilot Hole Size
Pilot Hole Size
Room Ventilation
Room Ventilation
Paint Thinning
Paint Thinning
Baseboard & Trim
Baseboard & Trim
Blind Size
Blind Size
Picture Hanging
Picture Hanging
Drain Slope
Drain Slope
Screw Calculator
Screw Calculator
Board Feet
Board Feet
Fence Calculator
Fence Calculator
Wood Shrinkage
Wood Shrinkage
Caulk Calculator
Caulk Calculator
Heat Loss
Heat Loss
Furniture Fit
Furniture Fit
Moving Boxes
Moving Boxes
Storage Capacity
Storage Capacity
Plywood Cuts
Plywood Cuts
Shelf Sag
Shelf Sag

Expected Value Calculator (Mean, Variance, Standard Deviation)

Following your probability distribution table, enter each possible value x and its probability p, one row at a time. The light gray example is the prize from one raffle ticket ($0 with 70%, $1 with 20%, $5 with 9% and $100 with 1%).

Enter numbers only. A probability can be entered as 0.2, 20% or 1/5, and the probabilities in all rows must add up to 1. Values can also be negative (a loss). Leave both "value" and "probability" blank in rows you do not use.
Result and graph
Enter pairs of values and probabilities in the fields on the left and press "Calculate". The result and a graph will appear here.

What you can do on this page

  • Enter a probability distribution table (pairs of a possible value \(x\) and its probability \(p\), 2 to 10 rows), and you get the expected value \(E(X)\), the variance \(\mathrm{Var}(X)\) and the standard deviation \(\sigma(X)\) on the spot
  • Answers are shown both as a fraction in lowest terms (the exact value), such as \(\dfrac{7}{2}\), and as a decimal. You can also see the steps, with your numbers put into \(E(X) = x_1 p_1 + x_2 p_2 + \cdots\)
  • It automatically checks that the probabilities add up to exactly 1. If they do not, it tells you what the current total is
  • You can enter a probability as 0.2, 20% or 1/5. Values can also be negative (a loss)
  • The result includes a bar chart of the probability distribution, with the expected value \(E(X)\) marked by a vertical dashed line
This page handles random variables with a finite number of possible values (discrete random variables). It does not handle random variables that take continuous values, such as height.

What is this calculation used for?

Putting a number on "what you get back per ticket" in lotteries and loot boxes

The expected value, "prize × chance of winning" added up over every prize, is exactly the average return per ticket. In big US lottery games such as Powerball, about half of ticket sales goes into the prize pool, so the expected value of a ticket is well below its price.
You can do the same calculation for loot boxes in video games. Using the published drop rates (probabilities), it is the basis for estimating "about how much it will cost to get the item you want".

Setting insurance premiums (the basis of how insurers set prices)

Life and auto insurance premiums start from the expected amount paid out: "each claim payment × the chance of that accident or illness", added up. Operating costs and other amounts are then added on top. There is a whole profession, the actuary, that specializes in this kind of calculation.
From the customer's side, insurance is a deal where you pay more than you get back on average (by expected value). What you buy is peace of mind against a rare but large loss.

Comparing investment return and risk on the same scale

In investing, it is common to treat the expected value of the return (rate of return) as "the gain you can expect" and the standard deviation as "the risk (the size of the swings)". If two investments have the same expected return, the one with the smaller standard deviation moves up and down more gently.
The idea on this page, looking at "how high the expected value is" and "how big the spread is" as two separate numbers, carries straight over into real-world finance.

Game balancing (designing rewards and damage)

Board game and video game designers calculate expected values, such as "the sum of two dice", "the damage per attack" and "the value of an item from a treasure chest", to balance strength and rewards.
For example, "100 damage with a 50% chance" and "always 50 damage" both have an expected value of 50, but their variances differ, so the two moves feel different to play. Designers tune both the expected value and the spread to create the experience they want.

Formulas and graph

Expected value (mean of a random variable)
Graph
Standard notation (the usual math form)
\(E(X)\) \(=\) \(x_1\) \(\times\) \(p_1\) \(+\) \(\cdots\) \(+\) \(x_n\) \(\times\) \(p_n\)
In words (symbols replaced with words)
③ \(E(X)\): expected value \(=\) ① \(x_1\): first value \(\times\) ② \(p_1\): its probability \(+\) \(\cdots\) \(+\) \(x_n\): last value \(\times\) \(p_n\): its probability
The formula in words
① Take each of the \(x_1,\ x_2,\ \dots,\ x_n\): possible values
② multiply it by its \(p_1,\ p_2,\ \dots,\ p_n\): probabilities of those values and add them all up
③ and you get the \(E(X)\): expected value
Quick example
The expected value of the number \(X\) you get when you roll a die once (each number has probability \(\dfrac{1}{6}\)) is
\(E(X)\): expected roll \(=\) roll 1 \(\times\) probability \(\frac{1}{6}\) \(+\) \(\cdots\) \(+\) roll 6 \(\times\) probability \(\frac{1}{6}\)
\(E(X) = 1 \times \dfrac{1}{6} + 2 \times \dfrac{1}{6} + 3 \times \dfrac{1}{6} + 4 \times \dfrac{1}{6} + 5 \times \dfrac{1}{6} + 6 \times \dfrac{1}{6}\)
\(E(X) = \dfrac{1 + 2 + 3 + 4 + 5 + 6}{6} = \dfrac{21}{6} = \dfrac{7}{2} = 3.5\)
Key idea
The expected value tells you "on average, how much you get per try". It is an average weighted by probability (the sum of each value × how likely it is). If you roll a die thousands or tens of thousands of times and average the numbers you get, the average gets closer and closer to this 3.5 (the law of large numbers). You can never actually roll a 3.5. The key is to think of the expected value not as "a prediction of the next result" but as "the average per try when you repeat many times". As the graph above shows, if you think of the probability distribution as weights placed along a line, the expected value is the balance point.
Variance (how spread out the values are)
Standard notation (the usual math form)
\(\mathrm{Var}(X)\) \(=\) \(E(X^{2})\) \(-\) \([E(X)]^{2}\)
In words (symbols replaced with words)
③ \(\mathrm{Var}(X)\): variance \(=\) ① \(E(X^2)\): mean of the squares \(-\) ② \([E(X)]^2\): square of the expected value
The formula in words
① Take the \(E(X^2)\): square first, then average
② subtract the \([E(X)]^2\): average first, then square
③ and you get the \(\mathrm{Var}(X)\): variance
Quick example
The variance of the number \(X\) you roll on a die (expected value \(E(X) = \dfrac{7}{2}\)) is
\(\mathrm{Var}(X)\): variance of the roll \(=\) \(E(X^2)\): mean of the squared rolls \(-\) square of the expected value \(\left(\frac{7}{2}\right)^2\)
\(E(X^{2}) = 1^{2} \times \dfrac{1}{6} + 2^{2} \times \dfrac{1}{6} + 3^{2} \times \dfrac{1}{6} + 4^{2} \times \dfrac{1}{6} + 5^{2} \times \dfrac{1}{6} + 6^{2} \times \dfrac{1}{6} = \dfrac{91}{6}\)
\(\mathrm{Var}(X) = \dfrac{91}{6} - \left(\dfrac{7}{2}\right)^{2} = \dfrac{182}{12} - \dfrac{147}{12} = \dfrac{35}{12}\)
Key idea
The variance tells you how spread out the values are around the expected value. Its original definition squares each distance from the expected value \(\mu = E(X)\) (the deviation) and averages them: \(\mathrm{Var}(X) = (x_1 - \mu)^2 p_1 + (x_2 - \mu)^2 p_2 + \cdots + (x_n - \mu)^2 p_n\). You can read the meaning, "the average of the squared deviations", right off this formula. However, the definition needs one subtraction from \(\mu\) for every row, which is a lot of work. Rearranging it gives the simpler form above, \(\mathrm{Var}(X) = E(X^2) - [E(X)]^2\) ("the mean of the squares minus the square of the mean"), often called the shortcut formula. Textbooks use it for most actual calculations, and this calculator also shows its steps with this formula. Even with the same expected value, a larger variance means a distribution with bigger swings between winning and losing. For example, "a ticket that always pays $100" and "a ticket that pays $0 or $200 with equal chance" both have an expected value of $100, but the second has a larger variance.
Standard deviation
Standard notation (the usual math form)
In words (symbols replaced with words)
\(\sigma(X)\) \(=\) \(\sqrt{\mathrm{Var}(X)}\)
② \(\sigma(X)\): standard deviation \(=\) ① positive square root of the variance \(\mathrm{Var}(X)\)
The formula in words
① Take the positive square root of the \(\mathrm{Var}(X)\): variance
② and you get the \(\sigma(X)\): standard deviation
Quick example
The standard deviation of the number \(X\) you roll on a die (variance \(\mathrm{Var}(X) = \dfrac{35}{12}\)) is
\(\sigma(X)\): standard deviation of the roll \(=\) positive square root of the variance \(\frac{35}{12}\)
\(\sigma(X) = \sqrt{\dfrac{35}{12}} \approx 1.71\)
Key idea
The variance is the average of "squared deviations", so its units are squared too (if the prize is in dollars, the variance is in dollars × dollars). That makes it hard to get a feel for the size of the spread, so you take the square root to return to the original units. That is the standard deviation. When you look at it together with the expected value, as in "a raffle ticket with an expected value of $1.65 and a standard deviation of about $9.99", you can compare "how big the swings around the average are" in the same units.
The expected value \(E(X) = x_1 p_1 + x_2 p_2 + \cdots + x_n p_n\) is an average weighted by probability: add up "each value × its probability". The spread is measured by the variance \(\mathrm{Var}(X) = E(X^2) - [E(X)]^2\) and its square root, the standard deviation \(\sigma(X)\).

Symbols and terms

Symbols

\(X\) capital X A random variable: a variable whose value is decided by the result of a trial, such as the number you roll on a die. Because it is a "container for a result" whose content is not yet decided, it is written with a capital letter to tell it apart from ordinary variables.
\(x_1,\ x_2,\ \dots,\ x_n\) x sub 1, x sub 2, ..., x sub n Each of the possible values of the random variable \(X\). The small number at the lower right (the subscript) only tells which value it is in the list; it has nothing to do with the value itself.
\(p_1,\ p_2,\ \dots,\ p_n\) p sub 1, p sub 2, ..., p sub n The probability of each value. \(p\) is the first letter of "probability". They always add up to 1.
\(n\) n The number of possible values (the number of rows in the probability distribution table). The letter \(n\), from "number", is often used for a count.
\(E(X)\) E of X The expected value of the random variable \(X\). \(E\) is the first letter of "expected value" (or "expectation"). It stands for one number, "the expected value of \(X\)"; it is not \(E\) times \(X\).
\(\mu\) mu The Greek letter often used for the expected value (the mean). It corresponds to "m" for "mean". Textbooks set \(\mu = E(X)\) to write the definition of the variance more compactly.
\(\mathrm{Var}(X)\) variance of X The variance of the random variable \(X\). It is the average of the squared distances from the expected value (the deviations) and shows how spread out the values are. Some books write it as \(V(X)\) or \(\sigma^2\).
\(\sigma(X)\) sigma of X The standard deviation of the random variable \(X\). \(\sigma\) is the lowercase Greek letter sigma, the Greek "s" for "standard deviation". It is the positive square root of the variance. Also written \(\sigma\) or SD(X).
\(X^2\) X squared A new random variable made by squaring the value of \(X\). \(E(X^2)\) is "square each possible value first, then take the average weighted by probability".
\(\sqrt{\phantom{0}}\) square root (radical sign) The symbol for the number (0 or more) that gives the number inside when squared, the positive square root. For example, \(\sqrt{9} = 3\). The standard deviation is found by putting the variance under this symbol.

Terms

random variable A variable whose value is decided by the result of a trial (an experiment or observation whose result is decided by chance), such as the number rolled on a die or the prize from a raffle ticket. It is usually written with a capital \(X\).
probability distribution The list that matches each possible value of a random variable with its probability. Written as a table, it is a probability distribution table, and the input fields on this page take that table as it is.
trial An experiment or observation that can be repeated under the same conditions and whose result is decided by chance, such as rolling a die or drawing a raffle ticket.
expected value The mean of a random variable. It is each value times its probability, all added up, and it approaches "the average per try" when the trial is repeated many times. The symbol is \(E(X)\) or \(\mu\).
weighted average An average where each value is multiplied by a "weight" before adding, instead of simply adding and dividing by the count. The expected value is a weighted average with the probabilities as the weights.
variance A measure of how spread out the values are. It squares the distances from the expected value (the deviations) and averages them, weighted by probability. The symbol is \(\mathrm{Var}(X)\).
standard deviation The positive square root of the variance. Unlike the variance, it is in the same units as the original values, so it is easier to compare how spread out things are. The symbol is \(\sigma(X)\).
deviation The distance of a value from the expected value, \(x - \mu\). Deviations are a mix of positive and negative numbers, and their plain average is always 0, so the variance squares them before averaging.
law of large numbers The rule that as you repeat a trial more and more times, the average of the actual results gets closer and closer to the expected value. It is the basis for reading the expected value as "the average per try over many repetitions".
discrete random variable A random variable whose possible values are separate points (a finite number of values, or whole numbers), like the numbers on a die (1 to 6). This page handles this type. A random variable that takes continuous values, such as height, is called a continuous random variable, and its expected value is found with an integral.

Good to know before you start

Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
If you get stuck, going back over the topics in this list is the fastest way forward.

Basic probability (Grade 7 to high school)
  • Knowing that a probability is a number from 0 to 1 that shows how likely something is (probability \(\dfrac{1}{6}\) = happens about once in 6 times)
  • Being able to find probabilities by listing the possible outcomes, in situations like dice, coins and raffles
  • Knowing that the probabilities of all possible outcomes always add up to 1
Working with fractions and decimals (Grades 5–7)
  • Being able to multiply and add fractions (with a common denominator), for example \(1 \times \dfrac{1}{6} + 2 \times \dfrac{1}{6} = \dfrac{3}{6} = \dfrac{1}{2}\)
  • Being able to switch between fractions, decimals and percents (\(\dfrac{1}{5} = 0.2 = 20\%\))
The mean (Grade 6 to high school)
  • Knowing that mean = total ÷ count
  • Being able to picture the difference between a plain average, like a class test average, and a weighted average, where more likely values count more
Squares and square roots (Grade 8)
  • Knowing what squaring (multiplying a number by itself) and its opposite, the square root \(\sqrt{\phantom{0}}\), mean (for example, \(\sqrt{9} = 3\))
  • Knowing that the square of a negative number is positive (\((-2)^{2} = 4\))
Describing data (high school statistics)
  • Having calculated the mean, variance and standard deviation of a data set (this page is the "probability distribution version" of that, covered in AP Statistics and college statistics)
  • Knowing that the variance and standard deviation measure how spread out the values are

How to calculate it in Excel

Copy the whole table below and paste it into cell A1 in Excel. It works as is.
Table to find the expected value E(X) (raffle example)
Value x₁ (losing ticket, $0) 0
Probability p₁ 0.7
Value x₂ (prize $1) 1
Probability p₂ 0.2
Value x₃ (prize $5) 5
Probability p₃ 0.09
Value x₄ (prize $100) 100
Probability p₄ 0.01
Sum of probabilities (check that it is 1) =B2+B4+B6+B8
Expected value E(X) =B1*B2+B3*B4+B5*B6+B7*B8
Table to find the variance Var(X) (raffle example)
Value x₁ 0
Probability p₁ 0.7
Value x₂ 1
Probability p₂ 0.2
Value x₃ 5
Probability p₃ 0.09
Value x₄ 100
Probability p₄ 0.01
Expected value E(X) =B1*B2+B3*B4+B5*B6+B7*B8
Mean of the squares E(X²) =B1^2*B2+B3^2*B4+B5^2*B6+B7^2*B8
Variance Var(X) = E(X²) − [E(X)]² =B10-B9^2
Table to find the standard deviation σ(X)
Variance Var(X) 99.7275
Standard deviation σ(X) = √Var(X) =SQRT(B1)
After pasting, the upper rows (values and probabilities) are your inputs and the lower rows are calculated automatically. "*" is multiplication, "^2" means squared, and SQRT is the function for the square root.
The first table is the raffle example ($0 with 70%, $1 with 20%, $5 with 9% and $100 with 1%). The sum of the probabilities is 1 and the expected value is 1.65 (dollars).
The second table is the variance of the same raffle: the mean of the squares, 102.45, minus the square of the expected value, 2.7225, which is 99.7275.
The third table finds the standard deviation from that variance, about 9.99 (dollars). To add rows, add more value and probability pairs and extend the "B1*B2+…" part of the formulas in the same pattern.

How to calculate it in Google Sheets

Copy the whole table below and paste it into cell A1 in Google Sheets. It works as is.
Table to find the expected value E(X) (raffle example)
Value x₁ (losing ticket, $0) 0
Probability p₁ 0.7
Value x₂ (prize $1) 1
Probability p₂ 0.2
Value x₃ (prize $5) 5
Probability p₃ 0.09
Value x₄ (prize $100) 100
Probability p₄ 0.01
Sum of probabilities (check that it is 1) =B2+B4+B6+B8
Expected value E(X) =B1*B2+B3*B4+B5*B6+B7*B8
Table to find the variance Var(X) (raffle example)
Value x₁ 0
Probability p₁ 0.7
Value x₂ 1
Probability p₂ 0.2
Value x₃ 5
Probability p₃ 0.09
Value x₄ 100
Probability p₄ 0.01
Expected value E(X) =B1*B2+B3*B4+B5*B6+B7*B8
Mean of the squares E(X²) =B1^2*B2+B3^2*B4+B5^2*B6+B7^2*B8
Variance Var(X) = E(X²) − [E(X)]² =B10-B9^2
Table to find the standard deviation σ(X)
Variance Var(X) 99.7275
Standard deviation σ(X) = √Var(X) =SQRT(B1)
The same formulas as in Excel work as is. Copy the whole table, paste it into cell A1, and replace the values and probabilities with your own numbers.

How to calculate it in Python

from fractions import Fraction

# Probability distribution table (value and probability pairs). Raffle example: prize and chance of winning it
# A fractional probability can be written like Fraction(1, 6)
values = [Fraction(0), Fraction(1), Fraction(5), Fraction(100)]
probabilities = [Fraction("0.7"), Fraction("0.2"), Fraction("0.09"), Fraction("0.01")]

# Check that the probabilities add up to 1
total = sum(probabilities)
if total != 1:
    raise ValueError(f"The probabilities do not add up to 1 (total: {total})")

# Expected value E(X) = Σ x_i p_i
mean = sum(x * p for x, p in zip(values, probabilities))
# Mean of the squares E(X²) and variance Var(X) = E(X²) − [E(X)]²
mean_of_squares = sum(x * x * p for x, p in zip(values, probabilities))
variance = mean_of_squares - mean * mean
# Standard deviation σ(X) = √Var(X)
std_dev = float(variance) ** 0.5

print(f"Expected value E(X): {mean} = {float(mean)}")
print(f"Variance Var(X): {variance} = {float(variance)}")
print(f"Standard deviation σ(X): {std_dev}")
With the fractions module from the standard library, you can calculate with exact fractions and no decimal rounding errors. This example is the raffle ($0 with 70%, $1 with 20%, $5 with 9% and $100 with 1%). When you run it, it shows the expected value 33/20 = 1.65, the variance 39891/400 = 99.7275 and the standard deviation of about 9.9864. Change the values and probabilities and run it.

How to write it in LaTeX and other math languages (copy and paste)

Expected value (mean of a random variable)
E(X) = x₁p₁ + x₂p₂ + … + xₙpₙ
E(X) = x_1 p_1 + x_2 p_2 + \cdots + x_n p_n
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>E</mi><mo>(</mo><mi>X</mi><mo>)</mo>
    <mo>=</mo>
    <msub><mi>x</mi><mn>1</mn></msub><msub><mi>p</mi><mn>1</mn></msub>
    <mo>+</mo>
    <msub><mi>x</mi><mn>2</mn></msub><msub><mi>p</mi><mn>2</mn></msub>
    <mo>+</mo><mo>&#x22EF;</mo><mo>+</mo>
    <msub><mi>x</mi><mi>n</mi></msub><msub><mi>p</mi><mi>n</mi></msub>
  </mrow>
</math>
E(X) = x_1 p_1 + x_2 p_2 + cdots + x_n p_n
Total[x*p]
EX := add(x[i]*p[i], i = 1..n);
EX = sum(x .* p);
E(X) = x_1 p_1 + x_2 p_2 + … + x_n p_n
Variance (how spread out the values are)
Var(X) = E(X²) − [E(X)]²
\mathrm{Var}(X) = E(X^{2}) - [E(X)]^{2}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>Var</mi><mo>(</mo><mi>X</mi><mo>)</mo>
    <mo>=</mo>
    <mi>E</mi><mo>(</mo><msup><mi>X</mi><mn>2</mn></msup><mo>)</mo>
    <mo>&#x2212;</mo>
    <msup><mrow><mo>[</mo><mi>E</mi><mo>(</mo><mi>X</mi><mo>)</mo><mo>]</mo></mrow><mn>2</mn></msup>
  </mrow>
</math>
Var(X) = E(X^2) - [E(X)]^2
Total[x^2*p] - Total[x*p]^2
VX := add(x[i]^2*p[i], i = 1..n) - EX^2;
VX = sum(x.^2 .* p) - EX^2;
Var(X) = E(X^2) - [E(X)]^2
Standard deviation
σ(X) = √Var(X)
\sigma(X) = \sqrt{\mathrm{Var}(X)}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>&#x3C3;</mi><mo>(</mo><mi>X</mi><mo>)</mo>
    <mo>=</mo>
    <msqrt><mi>Var</mi><mo>(</mo><mi>X</mi><mo>)</mo></msqrt>
  </mrow>
</math>
sigma(X) = sqrt(Var(X))
Sqrt[Total[x^2*p] - Total[x*p]^2]
sigmaX := sqrt(VX);
sigmaX = sqrt(VX);
σ(X) = √(Var(X))

How to have ChatGPT  do the calculation

You are a calculation assistant for math (probability and statistics). Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing).

The probability distribution of a random variable X is given by this table.
Value x: 0, 1, 5, 100
Probability p: 0.7, 0.2, 0.09, 0.01

Show each of the following:
1. A check that the probabilities add up to 1
2. The expected value E(X) (both as a fraction in lowest terms or a whole number, and as a decimal)
3. The variance Var(X) (use the formula E(X²) − [E(X)]², and also show the value of E(X²))
4. The standard deviation σ(X) (as a decimal)

In Python, use the fractions module from the standard library to calculate exactly, and show the formulas you used and the numbers from the execution result.

How to Use
  1. 1
    Enter your numbers
    Type the numbers you want to calculate with into the input fields
  2. 2
    Calculate
    Press the "Calculate" button
  3. 3
    Check the result
    The result appears on the spot. The same page also explains the idea behind the calculation and the formula
  DataChef Features
Easy and Free
Unlimited conversions for free.
No technical knowledge required.
Intuitive and user-friendly operation.
No Registration Required
Available immediately after access.
Can be used without registering personal information.
Safe and Secure
Fully SSL encrypted communication.
Automatic file deletion by clicking "download".
Fast
High-speed site access
and rapid file conversion.
No Watermark
No watermark.
No attribution required.
Commercial Use Available
Free for commercial use.
No need to contact us for commercial use permission.