# Geometric Distribution Calculator

> Computes, for independent trials with success probability p, the probability that the first success occurs exactly on trial k, within the first k trials or later than trial k, plus the mean, variance, standard deviation and expected number of failures before the first success.

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

## Purpose

Computes, for independent trials with success probability p, the probability that the first success occurs exactly on trial k, within the first k trials or later than trial k, plus the mean, variance, standard deviation and expected number of failures before the first success.

**Use when:** You repeat independent attempts with the same success chance and ask how many attempts it takes until the first success (first six on a die, first defective item, first sale).

**Do not use when:** The number of trials is fixed and you count successes (use binomial-distribution), or the waiting time is continuous (use exponential-distribution).

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `probability_of_success` | number |  | required | Success probability on each trial, as a fraction between 0 and 1 (not a percentage). (> 0, max 1) |
| `trial` | integer |  | required | The trial on which the first success is of interest (k = 1 is the first attempt). (min 1, max 1000000) |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `probability_exact` | number |  | First success exactly on trial k: (1 − p)^(k−1) · p. |
| `probability_at_most` | number |  | First success within the first k trials: 1 − (1 − p)^k. |
| `probability_more_than` | number |  | No success in the first k trials: (1 − p)^k. |
| `mean` | number |  | Expected trials until the first success: 1/p. |
| `variance` | number |  | (1 − p)/p². |
| `std_dev` | number |  | √(1 − p) / p. |
| `expected_failures` | number |  | (1 − p)/p: mean of the alternative 'number of failures' form of the distribution. |

## Formula

`P(X = k) = (1 − p)^(k − 1) · p; P(X ≤ k) = 1 − (1 − p)^k; mean = 1/p; variance = (1 − p)/p²`

Uses the 'number of trials' convention (support k = 1, 2, …). The alternative convention counts failures before the first success (support 0, 1, …); its mean is (1 − p)/p, reported as expected_failures.

## Data Sources

- Wikipedia – Geometric distribution — https://en.wikipedia.org/wiki/Geometric_distribution (reference, retrieved 2026-09-24)
- Wolfram MathWorld – Geometric Distribution — https://mathworld.wolfram.com/GeometricDistribution.html (reference, retrieved 2026-09-24)

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/geometric-distribution?probability_of_success=…&trial=…`
- `POST https://tttkmbb.com/api/v1/calculate/geometric-distribution` 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/geometric-distribution · OpenAPI operationId `calculate_geometric_probability` 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": "geometric-distribution", "inputs": {…}}`

## Example

- First six on the 3rd roll of a die (p = 1/6): inputs `{"probability_of_success":0.1666667,"trial":3}` → `{"probability_exact":0.115741,"probability_at_most":0.421296,"probability_more_than":0.578704,"mean":6,"variance":30,"std_dev":5.4772,"expected_failures":5}`
- p = 0.2, first success on trial 5: inputs `{"probability_of_success":0.2,"trial":5}` → `{"probability_exact":0.08192,"probability_at_most":0.67232,"probability_more_than":0.32768,"mean":5,"variance":20,"std_dev":4.4721}`

```
GET https://tttkmbb.com/api/v1/calculate/geometric-distribution?probability_of_success=0.1666667&trial=3
```

## Limitations

The number of trials is fixed and you count successes (use binomial-distribution), or the waiting time is continuous (use exponential-distribution). Uses the 'number of trials' convention (support k = 1, 2, …). The alternative convention counts failures before the first success (support 0, 1, …); its mean is (1 − p)/p, reported as expected_failures. All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**Which convention does this calculator use?**

k counts the trial of the first success (k ≥ 1). If your textbook counts failures before the first success, subtract 1 from k and use expected_failures for the mean.

**Is the geometric distribution memoryless?**

Yes: after any number of failures, the distribution of the remaining number of trials until success is unchanged. Past failures do not make a success 'due'.

## Related

- [Binomial Distribution Calculator](https://tttkmbb.com/statistics/binomial-distribution.md) — Number of successes in a fixed number of trials.
- [Exponential Distribution Calculator](https://tttkmbb.com/statistics/exponential-distribution.md) — Continuous-time analogue (memoryless waiting time).
