Hverdag · verktøy

Sannsynlighetskalkulator

Skriv inn P(A), P(B) og P(A and B) som desimaltall fra 0 til 1.

Kjøres i nettleseren. Ingen opplasting.

Values are processed locally in this browser.

Result

—

Om verktøyet

Sannsynlighetskalkulator sem complicação.

Kalkulatoren bruker hendelsessannsynlighetene du oppgir. Den antar ikke uavhengighet; skriv inn sannsynligheten for snittet eksplisitt.

Veiledning

Slik bruker du Sannsynlighetskalkulator

This probability calculator works with two events, A and B. You type the chance of A, the chance of B and the chance that both happen, each as a decimal from 0 to 1. It returns the chance of A or B, the chance that A does not happen, and the two conditional probabilities: A given B and B given A. It does not assume the events are independent, and it does not tell you whether your starting numbers are realistic.

Slik gjør du

  1. Write the chance of event A as a decimal between 0 and 1. Use 0.25 for 25 percent. Percent signs and fractions are not accepted.
  2. Write the chance of event B in the same way.
  3. Write the chance that A and B both happen, called the intersection. It cannot be larger than the smaller of the first two numbers.
  4. Press Calculate and read the four lines of the result. Press Copy result to take them with you, or Clear to start again.

Eksempler

The default values

Du skriver inn
P(A)
0.5
P(B)
0.4
P(A og B)
0.2
Du får
P(A eller B)
0.7
P(ikke A)
0.5
P(A gitt B)
0.5
P(B gitt A)
0.4

The chance of either is 0.5 + 0.4 − 0.2 = 0.7. Here 0.5 × 0.4 equals 0.2, so the two events behave as independent: knowing B did not change the chance of A.

Kjørt med verktøyets egen kode.

Events that influence each other

Du skriver inn
P(A)
0.4
P(B)
0.5
P(A og B)
0.3
Du får
P(A eller B)
0.6
P(ikke A)
0.6
P(A gitt B)
0.6
P(B gitt A)
0.75

A given B is 0.3 ÷ 0.5 = 0.6, higher than the plain 0.4. B given A is 0.3 ÷ 0.4 = 0.75. The events are linked, because the intersection is not 0.4 × 0.5.

Kjørt med verktøyets egen kode.

Events that cannot happen together

Du skriver inn
P(A)
0.3
P(B)
0.5
P(A og B)
0
Du får
P(A eller B)
0.8
P(ikke A)
0.7
P(A gitt B)
0
P(B gitt A)
0

With an intersection of 0, the chances simply add up to 0.8. If one event happens, the other cannot, so both conditional probabilities are 0.

Kjørt med verktøyets egen kode.

Numbers that do not fit together

Du skriver inn
P(A)
0.9
P(B)
0.9
P(A og B)
0.5
Du får
Melding
Use probabilities from 0 to 1 and an intersection valid for both events.

Two events that are each 90 percent likely must overlap by at least 0.9 + 0.9 − 1 = 0.8. An intersection of 0.5 is too small, so the tool refuses to calculate.

Kjørt med verktøyets egen kode.

Når det er nyttig

  • Check homework on the addition rule and on conditional probability.
  • Find the chance of at least one of two outcomes when you know how often each and both occur.
  • Turn survey results, such as how many people own a bike, a car or both, into probabilities for further analysis.
  • Test whether two events look independent by comparing P(A and B) with P(A) times P(B).
  • Get a quick second opinion on a hand calculation before you hand it in.

Begrensninger

  • All three inputs must be decimals from 0 to 1. The intersection must be at least P(A) + P(B) − 1 and at most the smaller of P(A) and P(B), or the tool shows an error.
  • The tool only handles two events and gives four results. It does not show P(not B), the chance of exactly one event, or an independence verdict.
  • Results are shown with up to six decimal places and trailing zeros are dropped, so a long decimal may be rounded in the display.
  • When P(B) is 0 the tool says P(A given B) is undefined, and when P(A) is 0 it says the same for P(B given A).
  • The output is only as good as the numbers you enter. The tool cannot check that your chances are realistic for your situation.

Tips

  • Convert percentages to decimals before you type them: divide by 100, so 35 percent becomes 0.35.
  • If you only know that A and B are independent, multiply the first two numbers yourself and type the product as the third.
  • Compare P(A given B) with P(A). If they are equal, B gives no information about A.
  • Write a one-line description of each event first, so you do not swap A and B when you read the conditional lines.

Vanlige spørsmål

Sobre Sannsynlighetskalkulator.

How do I calculate the probability of A or B?

Add the chance of A and the chance of B, then subtract the chance that both happen. That is the addition rule, P(A or B) = P(A) + P(B) − P(A and B). The calculator does this and shows the result on the first line.

What is the difference between P(A given B) and P(A and B)?

P(A and B) is the chance that both events happen out of all cases. P(A given B) looks only at the cases where B happened and asks how often A happened there. It equals P(A and B) divided by P(B).

Does the calculator assume the events are independent?

No. You enter the intersection yourself, so it works for events that influence each other. If you know they are independent, multiply P(A) by P(B) and enter that product as the intersection.

Why does the tool refuse my numbers?

The three values must fit together. The intersection can never be bigger than P(A) or P(B), and it must be at least P(A) + P(B) − 1. Any value outside 0 to 1, or an empty box, also causes an error message.

Can I enter percentages or fractions?

Use decimals between 0 and 1. A value like 50 is rejected as out of range, and the number box does not read fractions like 1/2. Divide percentages by 100 first, so 50 percent becomes 0.5.

What does undefined mean in the result?

It appears when the event you are conditioning on has probability 0. Asking how often A happens when B never happens has no meaning, so the tool says P(A given B) is undefined because P(B) is zero.

Can I use this for dice, coins or cards?

Yes, if you work out the three probabilities yourself first. For example, for one die, A could be an even number (0.5), B a number above 3 (0.5) and both (two of six outcomes, about 0.333333). The tool does not count outcomes for you.

What if I need more than two events?

This tool covers two events only. For three or more events, or for binomial, normal and Poisson models, you need a different calculation. Check that the method you pick fits the way your data was collected.

Is my data uploaded?

No. The calculation runs in your browser and the numbers you type are not uploaded. Use Copy result if you want to keep the four lines for later.

Hvordan bruker du Sannsynlighetskalkulator?

Skriv inn P(A), P(B) og P(A and B) som desimaltall fra 0 til 1.

Lastes dataene mine opp til en server?

Nei. Behandlingen skjer i nettleseren din, og opplysningene dine lastes ikke opp.