# Probability of Two Events Calculator

> Combines the probabilities of two events A and B that are either independent or mutually exclusive into the probabilities of both, at least one, exactly one, one but not the other, and neither occurring.

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

## Purpose

Combines the probabilities of two events A and B that are either independent or mutually exclusive into the probabilities of both, at least one, exactly one, one but not the other, and neither occurring.

**Use when:** You know P(A) and P(B) and how the events relate (independent or mutually exclusive) and need P(A and B), P(A or B), P(neither) or P(exactly one).

**Do not use when:** The events are dependent with a known conditional probability (apply P(A and B) = P(A)·P(B|A) directly), you need the probability of k successes in repeated trials (use binomial-distribution), or you need an expected payoff (use expected-value).

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `probability_a` | number |  | required | Probability of event A, as a number between 0 and 1 (0.25 for 25 %). (min 0, max 1) |
| `probability_b` | number |  | required | Probability of event B, between 0 and 1. (min 0, max 1) |
| `relationship` | enum: independent \| mutually_exclusive |  | optional, default "independent" | How A and B relate: independent events multiply (P(A and B) = P(A)·P(B)); mutually exclusive events cannot occur together (P(A and B) = 0). |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `probability_a_and_b` | number |  | Both events occur. |
| `probability_a_or_b` | number |  | At least one of the events occurs. |
| `probability_a_not_b` | number |  | A occurs but B does not. |
| `probability_b_not_a` | number |  | B occurs but A does not. |
| `probability_exactly_one` | number |  | Exactly one of the two events occurs. |
| `probability_neither` | number |  | Neither event occurs = 1 − P(A or B). |

## Formula

`Independent: P(A and B) = P(A)·P(B). Mutually exclusive: P(A and B) = 0. Then P(A or B) = P(A) + P(B) − P(A and B); P(A not B) = P(A) − P(A and B); P(exactly one) = P(A) + P(B) − 2·P(A and B); P(neither) = 1 − P(A or B)`

The identities follow from the addition rule of probability; independence is an assumption about the events, not something the calculator can check. Mutually exclusive events require P(A) + P(B) ≤ 1.

## Data Sources

- Wikipedia – Independence (probability theory) — https://en.wikipedia.org/wiki/Independence_(probability_theory) (reference, retrieved 2026-09-23)
- Wikipedia – Mutual exclusivity — https://en.wikipedia.org/wiki/Mutual_exclusivity (reference, 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/probability-of-events?probability_a=…&probability_b=…`
- `POST https://tttkmbb.com/api/v1/calculate/probability-of-events` 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/probability-of-events · OpenAPI operationId `calculate_event_probabilities` 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": "probability-of-events", "inputs": {…}}`

## Example

- Two independent coin flips (heads): inputs `{"probability_a":0.5,"probability_b":0.5,"relationship":"independent"}` → `{"probability_a_and_b":0.25,"probability_a_or_b":0.75,"probability_a_not_b":0.25,"probability_b_not_a":0.25,"probability_exactly_one":0.5,"probability_neither":0.25}`
- Mutually exclusive 0.2 and 0.3: inputs `{"probability_a":0.2,"probability_b":0.3,"relationship":"mutually_exclusive"}` → `{"probability_a_and_b":0,"probability_a_or_b":0.5,"probability_a_not_b":0.2,"probability_exactly_one":0.5,"probability_neither":0.5}`

```
GET https://tttkmbb.com/api/v1/calculate/probability-of-events?probability_a=0.5&probability_b=0.5&relationship=independent
```

## Limitations

The events are dependent with a known conditional probability (apply P(A and B) = P(A)·P(B|A) directly), you need the probability of k successes in repeated trials (use binomial-distribution), or you need an expected payoff (use expected-value). The identities follow from the addition rule of probability; independence is an assumption about the events, not something the calculator can check. Mutually exclusive events require P(A) + P(B) ≤ 1. All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**What is the difference between independent and mutually exclusive?**

Independent events do not influence each other (rolling a die twice); mutually exclusive events cannot happen together (rolling a 1 and rolling a 6 on the same roll). Two events with non-zero probability cannot be both.

**Can I enter percentages?**

No, enter fractions between 0 and 1: 0.3 for 30 %. The outputs are fractions as well.

## Related

- [Binomial Distribution Calculator](https://tttkmbb.com/statistics/binomial-distribution.md) — Probability of k successes in repeated independent trials.
- [Expected Value Calculator](https://tttkmbb.com/statistics/expected-value.md) — Average outcome of a probabilistic payoff.
