# Expected Value Calculator

> Computes the expected value E[X] = Σ x·p(x), the variance and the standard deviation of a discrete random variable from its list of outcomes and their probabilities.

- Calculator id: `expected-value` · Category: Statistics & Probability (`statistics`) · Tool name: `calculate_expected_value`
- Canonical page: https://tttkmbb.com/statistics/expected-value · This document: https://tttkmbb.com/statistics/expected-value.md · JSON definition: https://tttkmbb.com/statistics/expected-value.json

## Purpose

Computes the expected value E[X] = Σ x·p(x), the variance and the standard deviation of a discrete random variable from its list of outcomes and their probabilities.

**Use when:** You have a set of possible outcomes (payoffs, scores, counts) with known probabilities and need the long-run average and its spread: bets, lotteries, insurance, decision analysis.

**Do not use when:** The probabilities are unknown and you have observed data instead (use descriptive-statistics), or the weights are not probabilities (use weighted-average).

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `values` | number_list |  | required | Numeric value of each possible outcome (negative for losses). |
| `probabilities` | number_list |  | required | Probability of each outcome as a fraction between 0 and 1, in the same order as values; they must sum to 1 (within 0.001). |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `expected_value` | number |  | Σ values × probabilities: the long-run average outcome. |
| `variance` | number |  | Σ probabilities × (values − E[X])². |
| `std_dev` | number |  | √variance. |
| `count` | integer |  | Number of outcome/probability pairs. |

## Formula

`E[X] = Σ values_i × probabilities_i; variance = Σ probabilities_i × (values_i − E[X])²; std_dev = √variance`

Probabilities are checked to sum to 1 within 0.001 (to tolerate rounded inputs such as 0.1667) and rescaled to sum exactly to 1 before computing; a note is added when rescaling changed them by more than 10⁻⁶.

## Data Sources

- Wikipedia – Expected value — https://en.wikipedia.org/wiki/Expected_value (reference, retrieved 2026-09-23)
- NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.1 Measures of Location — https://www.itl.nist.gov/div898/handbook/eda/section3/eda351.htm (government, retrieved 2026-09-23)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/expected-value?values=…&probabilities=…`
- `POST https://tttkmbb.com/api/v1/calculate/expected-value` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/expected-value · OpenAPI operationId `calculate_expected_value` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "expected-value", "inputs": {…}}`

## Example

- Payouts 0, 10, 100 with probabilities 0.7, 0.25, 0.05: inputs `{"values":[0,10,100],"probabilities":[0.7,0.25,0.05]}` → `{"expected_value":7.5,"variance":468.75,"std_dev":21.6506,"count":3}`
- Fair six-sided die: inputs `{"values":[1,2,3,4,5,6],"probabilities":[0.1666667,0.1666667,0.1666667,0.1666667,0.1666667,0.1666667]}` → `{"expected_value":3.5,"variance":2.9167,"std_dev":1.7078}`

```
GET https://tttkmbb.com/api/v1/calculate/expected-value?values=0%2C10%2C100&probabilities=0.7%2C0.25%2C0.05
```

## Limitations

The probabilities are unknown and you have observed data instead (use descriptive-statistics), or the weights are not probabilities (use weighted-average). Probabilities are checked to sum to 1 within 0.001 (to tolerate rounded inputs such as 0.1667) and rescaled to sum exactly to 1 before computing; a note is added when rescaling changed them by more than 10⁻⁶. All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**What does a negative expected value mean?**

On average you lose that amount per play; for a lottery ticket or casino bet the expected value is negative because the house keeps a margin. It says nothing about any single outcome.

**Can I enter percentages?**

No, probabilities are fractions: 0.25 for 25 %. Values can be any numbers, including negative amounts for losses.

## Related

- [Probability of Two Events Calculator](https://tttkmbb.com/statistics/probability-of-events.md) — Combine probabilities of events before computing payoffs.
- [Weighted Average Calculator](https://tttkmbb.com/statistics/weighted-average.md) — Weighted mean when the weights are not probabilities.
- [Descriptive Statistics Calculator](https://tttkmbb.com/statistics/descriptive-statistics.md) — Mean and variance of observed data instead of a known distribution.
