# Weighted Average Calculator

> Computes the weighted arithmetic mean Σ(w·x) / Σw of a list of values and a matching list of weights, along with the total weight and the unweighted mean for comparison.

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

## Purpose

Computes the weighted arithmetic mean Σ(w·x) / Σw of a list of values and a matching list of weights, along with the total weight and the unweighted mean for comparison.

**Use when:** Values contribute unequally to an average: course grades with credit weights, portfolio returns by allocation, survey answers with sampling weights, average price over different quantities.

**Do not use when:** All items count equally (use descriptive-statistics for the plain mean), or the weights are probabilities of outcomes (use expected-value, which also gives the variance).

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `values` | number_list |  | required | The values to average. |
| `weights` | number_list |  | required | Non-negative weight for each value, in the same order (percentages, credits, quantities); they need not sum to 1. |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `weighted_average` | number |  | Σ(values × weights) / Σweights. |
| `total_weight` | number |  | Sum of the weights. |
| `weighted_sum` | number |  | Σ(values × weights) before dividing by the total weight. |
| `simple_average` | number |  | Plain arithmetic mean of the values, for comparison. |
| `count` | integer |  | Number of value/weight pairs. |

## Formula

`weighted_average = Σ(values_i × weights_i) / Σ weights_i`

## Data Sources

- Wikipedia – Weighted arithmetic mean — https://en.wikipedia.org/wiki/Weighted_arithmetic_mean (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/weighted-average?values=…&weights=…`
- `POST https://tttkmbb.com/api/v1/calculate/weighted-average` 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/weighted-average · OpenAPI operationId `calculate_weighted_average` 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": "weighted-average", "inputs": {…}}`

## Example

- Grades 90, 80, 70 weighted 50/30/20 %: inputs `{"values":[90,80,70],"weights":[0.5,0.3,0.2]}` → `{"weighted_average":83,"total_weight":1,"weighted_sum":83,"simple_average":80,"count":3}`
- 4, 8, 15 with weights 2, 1, 1: inputs `{"values":[4,8,15],"weights":[2,1,1]}` → `{"weighted_average":7.75,"total_weight":4,"weighted_sum":31,"simple_average":9}`

```
GET https://tttkmbb.com/api/v1/calculate/weighted-average?values=90%2C80%2C70&weights=0.5%2C0.3%2C0.2
```

## Limitations

All items count equally (use descriptive-statistics for the plain mean), or the weights are probabilities of outcomes (use expected-value, which also gives the variance). All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**Do the weights have to add up to 1 or 100?**

No. The result is divided by the total weight, so 50/30/20, 5/3/2 and 0.5/0.3/0.2 all give the same average.

**What if a weight is zero?**

That value is ignored. At least one weight must be positive; negative weights are rejected.

## Related

- [Descriptive Statistics Calculator](https://tttkmbb.com/statistics/descriptive-statistics.md) — Unweighted mean, median and spread of a list.
- [Expected Value Calculator](https://tttkmbb.com/statistics/expected-value.md) — Probability-weighted mean and variance of outcomes.
- [GPA Calculator](https://tttkmbb.com/everyday/gpa.md) — Credit-weighted grade point average.
