ForHosting KIT · Math

Joint probability calculator

Work out the chance that two events both happen: with P(A) of 0.5 and P(B) of 0.4, independent events give 0.2, or 20%. Add a correlation for dependent events and the result is checked against the lowest and highest values possible. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
P a
0.5
P b
0.4
You get
Correlation
0
Joint probability
0.2
Joint percentage
20
Product
0.2

Joint probability answers a single practical question: given the chance that event A occurs and the chance that event B occurs, what is the chance that both occur together? This calculator accepts two probabilities in the closed unit interval and either an independence flag or a Pearson correlation for the two Bernoulli indicators, then returns the joint probability P(A and B). When the events are independent the product rule applies and the joint equals P(A) times P(B). When they are dependent you supply a correlation between minus one and one, and the engine uses the bivariate Bernoulli identity, checking Fréchet–Hoeffding bounds so an impossible pair is rejected instead of silently clamped.

What joint probability means and which formula is used

Two events live on the same sample space, and the joint probability is the measure of the outcomes that belong to both. If the events do not influence each other they are independent, and Kolmogorov’s product rule says the joint is exactly the product of the two margins: P(A and B) equals P(A) times P(B). That is the default path of this calculator and the identity every introductory course drills with coins, cards, and weather.

Dependence is different. Modelling each event as a Bernoulli indicator with the given success probability, the only number that still has to be chosen is their Pearson correlation rho. The bivariate Bernoulli identity then recovers the joint as the product plus rho times the square root of P(A) times one minus P(A) times P(B) times one minus P(B).

That construction is not optional decoration: it is the unique linear interpolation between the Fréchet–Hoeffding lower and upper bounds once the two margins are fixed. Those bounds are always returned. The lower bound is the maximum of zero and P(A) plus P(B) minus one; the upper bound is the minimum of P(A) and P(B).

Any correlation that would push the joint outside that interval is refused, because no probability space can realise it. The response also echoes the cleaned margins, the product that independence would have given, a percentage form of the joint, a method tag of independence or correlation, and a short formula string suitable for a teaching sidebar. Certainty and impossibility remain first-class: a probability of zero or one forces the joint to the corresponding bound, and a non-zero correlation is then undefined and rejected rather than invented.

What to enter and when a result is refused

Send exactly one name per event so two conflicting numbers cannot silently race. A supplied correlation takes precedence over the independence flag so a form that still has the default checkbox ticked does not block a real rho. Setting independent to false without a correlation is an error, not a quiet product.

After parsing, every probability is checked against the unit interval: a number strictly below zero or strictly above one fails with a message that the field must be a probability between zero and one inclusive. That check is intentional and strict. Sending thirty-five instead of zero point three five is the most common classroom mistake; clamping it would hide a percent-versus-fraction bug.

An impossible correlation that would violate the Fréchet interval is likewise rejected. On success the body contains the cleaned margins, the joint, the joint as a percentage, the independence product, the two Fréchet bounds, the correlation actually used (zero on the independence path), the method tag, and the formula. Wire the free browser form for homework and call the identical contract from scripts when you need bulk checks.

Where joint probability shows up in real work

Secondary-school and college probability units constantly assign “both events occur” word problems, independence drills, and first encounters with correlated binary traits. Product and growth teams combine a click probability with a purchase probability under an independence assumption, then again under a modest positive correlation, to bound the chance that a visitor both clicks and buys. Reliability engineers combine two component failure probabilities the same way: independent parts give the product, shared-cause correlation lifts the joint, and the Fréchet upper bound is the worst-case simultaneous failure rate.

Epidemiologists and survey analysts recover the co-occurrence of two binary attributes from published margins plus an assumed association. Keep requests small, pin the rounded joint in tests, and you get reproducible answers without standing up a statistics library of your own. If you later need to turn a joint table into margins, or to compute P(A given B) from a known intersection, those are separate search intents and separate landings, not extra knobs on this page.

Classroom independence and both-events drills

Let students submit P(A) and P(B), toggle independence or a correlation, and verify the joint against the product rule and the Fréchet interval.

Click-and-convert or dual-failure bounds

Combine two event rates under independence, then again under a stated correlation, to bound the chance that both outcomes occur in a funnel or a reliability block.

How does the calculator use a correlation?

It treats the events as Bernoulli indicators and returns P(A)·P(B) + ρ·√[P(A)(1−P(A))P(B)(1−P(B))].

What happens if a probability is outside 0 to 1?

Any value strictly below 0 or above 1 is not a valid probability and is not charged.

What does it cost to run this calculator?

The browser tool is free and runs locally.

What are the lower and upper bounds shown with the result?

They are the smallest and largest joint probability that the two chances allow. The lower one is zero or P(A) plus P(B) minus one, whichever is larger; the upper one is the smaller of the two. For 0.5 and 0.4 they are 0 and 0.4.

What happens if one probability is 0 or 1 and I add a correlation?

A probability of 0 or 1 forces the joint result onto the matching bound, so there is nothing left for a correlation to change. A correlation other than zero is then undefined, and the calculator refuses it instead of inventing a number.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/stat/joint-probability

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/stat/joint-probability \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"p_a":0.5,"p_b":0.4}'
{
  "p_a": 0.5,
  "p_b": 0.4
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "stat.joint_probability",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Values outside zero to one fail with invalid_input.

Input contract, aliases, and how errors are reported

POST a JSON body with the two required fields p_a and p_b, each a finite number in the closed interval from zero to one. Classroom and form aliases are accepted: pA, pa, prob_a, and probability_a for the first event, and pB, pb, prob_b, and probability_b for the second. Independence is optional and defaults to true; aliases are indep and independence. When you need dependence, send correlation in the closed interval from minus one to one, or use the aliases rho, corr, or r. Values may arrive as JSON numbers or as numeric strings. Empty strings, missing required fields, non-numeric text, NaN, and Infinity fail with invalid_input naming the field. Successful API calls use the published base of $0.002 per item; validation failures do not consume prepaid balance.

Where joint probability shows up in real work

A single trusted oracle that returns cleaned JSON speeds grading, demo setup, and interactive lesson design, especially when students must see both the product and the feasible range. Curriculum authors want the same JSON shape free on the page and paid through the API so offline worksheets and online graders stay aligned. Because this capability is a pure parse engine, every successful call costs the published $0.002 base price with no model tokens and no outbound network, and failed validation does not consume balance.

Grading fixtures and simulation checks

Generate a deterministic expected joint for unit tests, LMS auto-graders, and Monte Carlo harnesses that must match an exact P(A and B).

How is joint probability calculated when the events are independent?

P(A ∩ B) = P(A) · P(B). Send p_a and p_b in [0, 1] and leave correlation unset (or keep independent true) to use the product rule.

What are the Fréchet bounds this API returns?

The feasible joint always lies between max(0, P(A)+P(B)−1) and min(P(A), P(B)). Those two numbers are frechet_lower and frechet_upper in every successful response.

Read the full KIT documentation →