Probability Calculator: Bayes' Theorem, Conditional Probability, Independent Events and Expected Value
Bayes, conditional probability and expected value.
Engineering student calculators
Free textbook calculators with every step shown, so you can check your own working. Pick one, type in your numbers and see the formulas worked out. Or switch to Ask a question for an explained answer. No account needed.
Calculated from standard textbook formulas, with every step shown. The formulas are fixed, so the working does not need checking: what matters is the numbers you type in. Use these calculators only if you are competent to choose the inputs (loads, material strength, dimensions, supports) and check your units and assumptions. For learning and checking your own working: design and sign-off are for a qualified engineer. Drafting Central does not store the numbers you type.
How this calculator works
Choose Bayes, two events, or a distribution.
For Bayes enter how common the condition is and the test's sensitivity and false positive rate. For two events enter P(A), P(B) and P(A and B).
For a distribution enter up to five values with their probabilities, which must add to 1.
Formulas used
- P(D|+) = \frac{P(+|D)P(D)}{P(+)}
- P(A\cup B) = P(A) + P(B) - P(A\cap B)
- P(A|B) = \frac{P(A\cap B)}{P(B)}
- E(X) = \sum xP(x)
Worked example
With the default numbers in the calculator above:
- Chance of a positive test (total probability): 9.81 %
- Chance of having the condition given a positive test (Bayes' theorem): 9.1743 %
- The same in natural frequencies for 10 000 people: 100 have it, of whom 90 test positive; of the 9900 who do not, 891 also test positive
- Chance of not having it given a negative test: 99.889 %
Change the numbers in the calculator to see the full working, every step, for your own case.
A second worked example
A different case, with these numbers: What do you want? Two events A and B.
- Probability of A or B (the addition rule): 0.7
- Probability of A given B: 0.5
- Probability of B given A: 0.4
- Neither A nor B happens: 0.3
- Are A and B independent? They are if P(A and B) = P(A) x P(B): 0.2 equals P(A and B): the events are independent
- Are they mutually exclusive? They are if they cannot both happen: No: they can both happen
Common questions
What is Bayes' theorem?
It turns the probability of a result given a condition into the probability of the condition given the result.
Why is a positive test often wrong for a rare condition?
Most people do not have the condition, so even a small false positive rate produces many more false positives than true ones.
How do I check if two events are independent?
They are independent if P(A and B) equals P(A) times P(B).
Related calculators
Got a question about this? Ask an engineering question and get a plain-language answer with references.
Further reading: Any first-year probability and statistics text.
Need a calculator we do not have?
Embed this calculator on your own page
Copy this code into your page. The calculator runs inside the frame and links back to Drafting Central.
Need this drawn, designed or checked?
Drafting Central is a mechanical engineering and drafting business working with customers across Australia and around the world. A calculator gives you the numbers; we can turn them into drawings and designs.
Need help with a real project?
Talk to Drafting Central →