Calculadora do Teorema de Bayes

P(A|B) = P(B|A)·P(A) / P(B).
Created by
Renato Passos, Eng. de Software
Reviewed by
Renato Passos, Eng. de Software

Last updated: Apr 18, 2026

P(A|B)
0,080000

Formula

P(A|B) = P(B|A)·P(A) / P(B)

About this calculator

The Bayes' Theorem Calculator solves the problem of finding the probability of an event A given that event B has occurred, using prior information. The formula P(A|B) = P(B|A) * P(A) / P(B) updates the initial belief about A based on evidence B. For example, in medical diagnostics, it calculates the actual chance of a disease after a positive test, considering test accuracy and disease prevalence.

It works simply: enter the probabilities P(A) (prior probability of A), P(B|A) (likelihood), and P(B) (marginal probability of B). The calculator returns P(A|B), the posterior probability. P(B) can be computed as P(B|A)*P(A) + P(B|not A)*P(not A), but here you provide the direct value. This helps avoid manual errors and speeds up statistical analysis.

Use this tool in situations like: evaluating the effectiveness of a medical test, predicting the probability of a customer defaulting based on history, or in spam filtering systems. It is essential in areas such as artificial intelligence, data science, and epidemiology, where evidence-based decisions are critical.

Caution: ensure the probabilities entered are accurate and represent the same population. The marginal probability P(B) must include all ways B can occur. Remember, Bayes' theorem does not create certainty; it only quantifies uncertainty based on available data.

Frequently asked questions

What is prior and posterior probability?

Prior probability is the initial belief about an event before observing evidence. Posterior probability is the updated belief after considering the evidence.

Do I need to know the marginal probability P(B) to use the calculator?

Yes, you need to enter P(B). If you don't know it, you can compute it as P(B|A)*P(A) + P(B|not A)*P(not A), but the calculator expects the direct value.

Can I use Bayes' theorem for COVID-19 tests?

Yes, it is common. For example, to calculate the probability of being infected given a positive test, considering test sensitivity and specificity and disease prevalence.

What happens if I enter probabilities that don't sum to 1?

The calculator will still work, but results may be inconsistent. Ensure P(A) and P(not A) sum to 1, and P(B) is between 0 and 1.

Is Bayes' theorem used in machine learning?

Yes, it is the basis for Naive Bayes classifiers, used in spam filters, sentiment analysis, and medical diagnosis.

Other Probabilidade e Chances calculators