Bayes’s Theorem for Conditional Probability

Last Updated : 30 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Bayes’s Theorem for Conditional Probability: Bayes’s Theorem is a fundamental result in probability theory that describes how to update the probabilities of hypotheses when given evidence. Named after the Reverend Thomas Bayes, this theorem is crucial in various fields, including engineering, statistics, machine learning, and data science. This article explores Bayes’s Theorem, its mathematical formulation, proof, and applications in engineering.

Bayes-Theorem-for-Conditional-Probability

Bayes’s Theorem for Conditional Probability

Read: Conditional Probability

What is Bayes’s Theorem?

Bayes’s Theorem provides a way to update the probability of a hypothesis based on new evidence. Mathematically, it is expressed as:

[Tex] P(A|B) = \frac{P(B|A)P(A)}{P(B)} [/Tex]

where:

  • P(A∣B) is the posterior probability of event A given event B.
  • P(B∣A) is the likelihood of event B given event A.
  • P(A) is the prior probability of event A.
  • P(B) is the marginal probability of event B.

Mathematical Formulation

To derive Bayes’s Theorem, we start with the definition of conditional probability:

[Tex]P(A \mid B) = \frac{P(A \cap B)}{P(B)} [/Tex]

[Tex]P(B \mid A) = \frac{P(A \cap B)}{P(A)} [/Tex]

Rearranging the second equation to express P(A∩B):

P(A∩B)=P(B∣A)⋅P(A)

Substitute this into the first equation:

[Tex]P(A|B) = \frac{P(B|A)P(A)}{P(B)}[/Tex]

This is the formula for Bayes’s Theorem.

Solved Examples of Bayes’s Theorem

Simple Disease Test

Problem 1: A disease affects 1% of the population. A test is 95% accurate for both positive and negative results. If a person tests positive, what’s the probability they have the disease?

Solution:

P(D) = 0.01, P(T|D) = 0.95, P(T|not D) = 0.05

P(T) = 0.95 * 0.01 + 0.05 * 0.99 = 0.0585

P(D|T) = (0.95 * 0.01) / 0.0585 ≈ 0.1624 or 16.24%

Factory Quality Control

Problem 2: A factory has two production lines. Line A produces 60% of the items and has a 3% defect rate. Line B produces 40% of the items and has a 2% defect rate. If an item is defective, what’s the probability it came from Line A?

Solution:

P(A) = 0.6, P(D|A) = 0.03, P(D|B) = 0.02

P(D) = 0.03 * 0.6 + 0.02 * 0.4 = 0.026

P(A|D) = (0.03 * 0.6) / 0.026 ≈ 0.6923 or 69.23%

Weather Forecast

Problem 3: The weather is sunny 70% of the time. A weather app is 80% accurate when predicting sunny days and 60% accurate for non-sunny days. If the app predicts a sunny day, what’s the probability it will actually be sunny?

Solution:

P(S) = 0.7, P(P|S) = 0.8, P(P|not S) = 0.4

P(P) = 0.8 * 0.7 + 0.4 * 0.3 = 0.68

P(S|P) = (0.8 * 0.7) / 0.68 ≈ 0.8235 or 82.35%

Email Classification

Problem 4: 20% of emails are important. A filter correctly identifies 90% of important emails and 85% of unimportant emails. If an email is marked as important, what’s the probability it’s actually important?

Solution:

P(I) = 0.2, P(M|I) = 0.9, P(M|not I) = 0.15

P(M) = 0.9 * 0.2 + 0.15 * 0.8 = 0.3

P(I|M) = (0.9 * 0.2) / 0.3 = 0.6 or 60%

Drug Test

Problem 5: 5% of athletes use performance-enhancing drugs. A drug test is 99% accurate for users and 95% accurate for non-users. If an athlete tests positive, what’s the probability they’re actually using drugs?

Solution:

P(D) = 0.05, P(T|D) = 0.99, P(T|not D) = 0.05

P(T) = 0.99 * 0.05 + 0.05 * 0.95 = 0.0945

P(D|T) = (0.99 * 0.05) / 0.0945 ≈ 0.5238 or 52.38%

Customer Loyalty

Problem 6: 30% of customers are loyal. Loyal customers have a 80% chance of making a purchase, while non-loyal customers have a 20% chance. If a customer makes a purchase, what’s the probability they’re loyal?

Solution:

P(L) = 0.3, P(P|L) = 0.8, P(P|not L) = 0.2

P(P) = 0.8 * 0.3 + 0.2 * 0.7 = 0.38

P(L|P) = (0.8 * 0.3) / 0.38 ≈ 0.6316 or 63.16%

Fire Alarm

Problem 7: The probability of a fire in a building is 0.1%. The fire alarm has a 99% chance of detecting a fire and a 0.5% false alarm rate. If the alarm goes off, what’s the probability there’s actually a fire?

Solution:

P(F) = 0.001, P(A|F) = 0.99, P(A|not F) = 0.005

P(A) = 0.99 * 0.001 + 0.005 * 0.999 = 0.005994

P(F|A) = (0.99 * 0.001) / 0.005994 ≈ 0.1652 or 16.52%

College Admissions

Problem 8: 40% of applicants have high test scores. Among those with high scores, 80% are admitted. Among those without high scores, 30% are admitted. If a student is admitted, what’s the probability they had high test scores?

Solution:

P(H) = 0.4, P(A|H) = 0.8, P(A|not H) = 0.3

P(A) = 0.8 * 0.4 + 0.3 * 0.6 = 0.5

P(H|A) = (0.8 * 0.4) / 0.5 = 0.64 or 64%

Car Insurance

Problem 9: 15% of drivers are high-risk. High-risk drivers have a 20% chance of an accident in a year, while others have a 5% chance. If a driver has an accident, what’s the probability they’re high-risk?

Solution:

P(H) = 0.15, P(A|H) = 0.2, P(A|not H) = 0.05

P(A) = 0.2 * 0.15 + 0.05 * 0.85 = 0.0725

P(H|A) = (0.2 * 0.15) / 0.0725 ≈ 0.4138 or 41.38%

Software Bug Detection

Problem 10 : A software has a 10% chance of containing a critical bug. A testing tool detects 95% of critical bugs and has a 8% false positive rate. If the tool reports a critical bug, what’s the probability the software actually has one?

Solution:

P(B) = 0.1, P(D|B) = 0.95, P(D|not B) = 0.08

P(D) = 0.95 * 0.1 + 0.08 * 0.9 = 0.167

P(B|D) = (0.95 * 0.1) / 0.167 ≈ 0.5689 or 56.89%

Practice Problems on Bayes’s Theorem for Conditional Probability

1).In a city, 30% of residents own dogs. Among dog owners, 80% walk their dogs daily. Among non-dog owners, 10% walk daily for exercise. If you see someone walking, what’s the probability they’re a dog owner?

2).A rare genetic disorder affects 1 in 10,000 people. A new test for this disorder is 99% accurate for both positive and negative results. If someone tests positive, what’s the probability they actually have the disorder?

3).A company produces widgets using two machines. Machine A produces 70% of the widgets and has a 3% defect rate. Machine B produces the remaining 30% and has a 1% defect rate. If a widget is defective, what’s the probability it was produced by Machine A?

4).In a school, 60% of students play sports. Among athletes, 80% pass their exams. Among non-athletes, 60% pass their exams. If a student passes their exam, what’s the probability they play sports?

5).A spam filter has a 98% chance of correctly identifying spam emails and a 95% chance of correctly identifying non-spam emails. About 40% of all emails are spam. If an email is flagged as spam by the filter, what’s the probability it’s actually spam?

6).In a certain population, 5% of people have a specific medical condition. A new screening test is 90% accurate for those with the condition and 95% accurate for those without. If a person tests positive, what’s the probability they have the condition?

7).A factory has three production lines: A, B, and C. Line A produces 50% of the items, B produces 30%, and C produces 20%. The defect rates are 2%, 3%, and 4% respectively. If an item is found to be defective, what’s the probability it came from Line B?

8).In a card game, 30% of players are experts, 50% are intermediate, and 20% are beginners. The probability of winning for each group is 70%, 40%, and 20% respectively. If a player wins a game, what’s the probability they’re an expert?

9).A security system has a 99.9% chance of detecting an intruder and a 0.1% false alarm rate. The probability of an actual intrusion on any given day is 0.01%. If the alarm goes off, what’s the probability there’s a real intruder?

10).In a dating app, 40% of users are actively seeking a relationship. Among these users, 70% respond to messages within a day. Among those not actively seeking, only 20% respond within a day. If a user responds to a message within a day, what’s the probability they’re actively seeking a relationship?

Applications of Bayes’s Theorem in Engineering

1. Signal Processing: In signal processing, Bayes’s Theorem is used in filtering and estimation techniques, such as the Kalman filter, to update the state estimates of a system based on new measurements.

2. Machine Learning: In machine learning, Bayes’s Theorem underpins various algorithms, including Naive Bayes classifiers. These algorithms are used for classification tasks in text analysis, spam detection, and sentiment analysis.

3. Reliability Engineering: In reliability engineering, Bayes’s Theorem helps in updating the probability of system failures based on observed data. It is used to improve maintenance schedules and predict future failures.

4. Medical Diagnosis: In biomedical engineering and healthcare, Bayes’s Theorem assists in diagnostic tests by updating the probability of a disease based on test results, leading to more accurate diagnoses.

5. Robotics: In robotics, Bayes’s Theorem is employed in probabilistic robotics to perform tasks such as localization and mapping. It helps robots update their position estimates based on sensor data.

Conclusion

Bayes’s Theorem is a powerful tool for updating probabilities based on new evidence, with wide-ranging applications in engineering, statistics, machine learning, and many other fields. Understanding and applying Bayes’s Theorem is essential for making informed decisions in the presence of uncertainty.

FAQs on Bayes’s Theorem for Conditional Probability

What is Bayes’s Theorem?

Bayes’s Theorem is a mathematical formula that describes how to update the probability of a hypothesis based on new evidence.

How is Bayes’s Theorem used in machine learning?

Bayes’s Theorem underpins algorithms such as Naive Bayes classifiers, which are used for classification tasks in text analysis, spam detection, and sentiment analysis.

What is the significance of Bayes’s Theorem in medical diagnosis?

In medical diagnosis, Bayes’s Theorem helps update the probability of a disease based on test results, leading to more accurate diagnoses.

Can you provide an example of Bayes’s Theorem in action?

Sure, consider a medical test for a disease with known probabilities of test accuracy and disease prevalence. Bayes’s Theorem can be used to calculate the probability of having the disease given a positive test result.

What are some applications of Bayes’s Theorem in engineering?

Applications include signal processing, reliability engineering, robotics, and more, where it is used to update estimates and improve decision-making based on new data.



Previous Article
Next Article

Similar Reads

Conditional Probability vs Bayes Theorem
Conditional probability and Bayes' Theorem are two imprtant concepts in probability where Bayes theorem is generalized version of conditional probability. Conditional probability is the probability of an event occurring given that another event has already occurred. Bayes' Theorem, named after the 18th-century mathematician Thomas Bayes, extends th
5 min read
Conditional Probability and Independence - Probability | Class 12 Maths
Let B be an event with non-zero probability. The conditional probability of any event A given B is defined as: [Tex]P(A|B) = \frac{P(A \cap B)}{ P(B)} [/Tex] In other words, P(A|B) is the probability measure of event A after observing the occurrence of event B. Two events are called independent if and only if P(A∩B) = P(A)P(B) (or equivalently, P(A
8 min read
Real Life Applications of Bayes’ Theorem
Bayes' Theorem is a mathematical formula used to update the probabilities of hypotheses based on new evidence or information. It calculates the likelihood of an event occurring given the probability of another related event. It helps us make better guesses about the world based on the information we already have. In this article, we are going to le
6 min read
Bayes' Theorem
Bayes' Theorem is used to determine the conditional probability of an event. It was named after an English statistician, Thomas Bayes who discovered this formula in 1763. Bayes Theorem is a very important theorem in mathematics, that laid the foundation of a unique statistical inference approach called the Bayes’ inference. It is used to find the p
12 min read
Probability: Joint vs. Marginal vs. Conditional
Probability is a fundamental concept in statistics that helps us understand the likelihood of different events occurring. Within probability theory, there are three key types of probabilities: joint, marginal, and conditional probabilities. Marginal Probability refers to the probability of a single event occurring, without considering any other eve
6 min read
Conditional Probability Practice Question
Conditional probability is a measure of the probability of an event occurring given that another event has already occurred. In simple words, conditional probability is like figuring out the chances of something happening given that something else has already happened. It’s like updating your guess based on new information. The probability of A giv
7 min read
Conditional Probability
Conditional probability is one type of probability in which the possibility of an event depends upon the existence of a previous event. As this type of event is very common in real life, conditional probability is often used to determine the probability of such cases. Conditional probability is the likelihood of an outcome occurring based on a prev
15+ min read
Rolle's Theorem and Lagrange's Mean Value Theorem
Rolle's Theorem and Lagrange's Mean Value Theorem: Mean Value Theorems (MVT) are the basic theorems used in mathematics. They are used to solve various types of problems in Mathematics. Mean Value Theorem is also called Lagrenges's Mean Value Theorem. Rolle’s Theorem is a subcase of the mean value theorem and they are both widely used. These theore
11 min read
Four Color Theorem and Kuratowski’s Theorem in Discrete Mathematics
The Four Color Theorem and Kuratowski's Theorem are two fundamental results in discrete mathematics, specifically in the field of graph theory. Both theorems address the properties of planar graphs but from different perspectives. In this article, we will understand about Four Color Theorem and Kuratowski’s Theorem in Discrete Mathematics, their de
14 min read
Probability Sampling vs Non-Probability Sampling
Sampling is a crucial aspect of research that involves selecting a subset of individuals or items from a larger population to infer conclusions about the entire population. Two primary categories of sampling techniques are probability sampling and non-probability sampling. Understanding the differences, advantages, and applications of each method i
4 min read
Proof: Why Probability of complement of A equals to one minus Probability of A [ P(A') = 1-P(A) ]
Probability refers to the extent of the occurrence of events. When an event occurs like throwing a ball, picking a card from the deck, etc., then there must be some probability associated with that event. Basic Terminologies: Random Event-If the repetition of an experiment occurs several times under similar conditions, if it does not produce the sa
4 min read
Conditional Statements & Implications - Mathematical Reasoning | Class 11 Maths
Generally, Conditional statements are the if-then statement in which p is called a hypothesis(or antecedent or premise) and q is called a conclusion( or consequence). Conditional Statements symbolized by p, q. A Conditional statement p -> q is false when p is true and q is false, and true otherwise. What are propositions? A proposition is a decl
5 min read
Conditional Convergence
Conditional convergence is convergence with a condition that is a series is said to be conditionally convergent if it converges, but not absolutely. This means that while the series ∑an​ converges, the series of the absolute values ∑∣an∣ diverges. A classic example of a conditionally convergent series is the alternating harmonic series ∑(−1)n+11/n,
5 min read
Absolute and Conditional Convergence
In mathematics, understanding the behavior of infinite series is crucial, and two important concepts in this context are absolute convergence and conditional convergence. An infinite series is said to be absolutely convergent if the series formed by taking the absolute values of its terms also converges. On the other hand, a series is conditionally
6 min read
Advanced master theorem for divide and conquer recurrences
The Master Theorem is a tool used to solve recurrence relations that arise in the analysis of divide-and-conquer algorithms. The Master Theorem provides a systematic way of solving recurrence relations of the form: T(n) = aT(n/b) + f(n) where a, b, and f(n) are positive functions and n is the size of the problem. The Master Theorem provides conditi
5 min read
Consensus Theorem in Digital Logic
Prerequisite - Properties of Boolean algebra, Minimization of Boolean Functions Redundancy theorem is used as a Boolean algebra trick in Digital Electronics. It is also known as Consensus Theorem: AB + A'C + BC = AB + A'C The consensus or resolvent of the terms AB and A'C is BC. It is the conjunction of all the unique literals of the terms, excludi
3 min read
Arden's Theorem in Theory of Computation
Arden's theorem state that: "If P and Q are two regular expressions over "∑", and if P does not contain "∈" , then the following equation in R given by R = Q + RP has a unique solution i.e., R = QP*." That means, whenever we get any equation in the form of R = Q + RP, then we can directly replace it with R = QP*. So, here we will first prove that R
4 min read
Theorem - The lengths of tangents drawn from an external point to a circle are equal - Circles | Class 10 Maths
Tangent is a straight line drawn from an external point that touches a circle at exactly one point on the circumference of the circle. There can be an infinite number of tangents of a circle. These tangents follow certain properties that can be used as identities to perform mathematical computations on circles. Here, in this article, we will learn
5 min read
Kleene's Theorem in TOC | Part-1
A language is said to be regular if it can be represented by using Finite Automata or if a Regular Expression can be generated for it. This definition leads us to the general definition that; For every Regular Expression corresponding to the language, a Finite Automata can be generated. For certain expressions like:- (a+b), ab, (a+b)*; It's fairly
4 min read
Theorem - The tangent at any point of a circle is perpendicular to the radius through the point of contact - Circles | Class 10 Maths
Tangent is a straight line drawn from an external point that touches a circle at exactly one point on the circumference of the circle. There can be an infinite number of tangents of a circle. These tangents follow certain properties that can be used as identities to perform mathematical computations on circles. Here, in this article, we will learn
3 min read
Multiplication Theorem
Probability refers to the extent of the occurrence of events. When an event occurs like throwing a ball, picking a card from the deck, etc ., then there must be some probability associated with that event. In terms of mathematics, probability refers to the ratio of wanted outcomes to the total number of possible outcomes. The probability of simulta
6 min read
Theorem - There is one and only one circle passing through three given non-collinear points | Class 9 Maths
Theorem Statement: There is one and only one circle passing through three given non-collinear points. Required Diagram: Given: Three non-collinear points P, Q, and R. To Prove: There is one and only one circle passing through P, Q, and R. Construction: Join PQ and QR. Draw perpendicular bisectors AL and BM of PQ and RQ respectively. Since P, Q, R i
3 min read
Understanding Markov's theorem with example
In this article, we will discuss the overview of the Markov theorem and also will discuss the expression of the Markov theorem, and finally concluded with an example to understand the Markov theorem. Let's discuss it one by one. Markov's Theorem : Markov theorem states that if R is a non-negative (means greater than or equal to 0) random variable t
2 min read
Class 11 NCERT Solutions - Chapter 8 Binomial Theorem - Exercise 8.2
Question 1. Find the coefficient of x5 in (x+3)8 Solution: The (r+1)th term of (x+3)8 is given by Tr+1 = 8Cr(x)8-r(3)r (eq1). Therefore for x5 we need to get 8-r =5 (Because we need to find x5. Therefore, power ox must be equal to 5) So we get r=3. Now, put r=3 in eq1. We get, Coefficient of x5 = 8C3(x)5(3)3 = 8!*33/(4!*4!) = 1512 Coefficient of x5
5 min read
Class 11 RD Sharma Solution - Chapter 18 Binomial Theorem- Exercise 18.2 | Set 1
Question 1. Find the 11th term from the beginning and the 11th term from the end in the expansion of (2x – 1/x2)25. Solution: We are given, (2x – 1/x2)25. The given expression contains 25 + 1 = 26 terms. So, the 11th term from the end is the (26 − 11 + 1) th term = 16th term from the beginning. Hence, T16 = T15+1 = 25C15 (2x)25-15 (−1/x2)15 = 25C15
9 min read
Class 11 RD Sharma Solutions - Chapter 18 Binomial Theorem- Exercise 18.2 | Set 2
Question 14. Find the middle terms in the expansion of:(i) (3x – x3/6)9 Solution: We have, (3x – x3/6)9 where, n = 9 (odd number). So, the middle terms are ((n + 1)/2) = ((9 + 1)/2) = 10/2 = 5 and ((n + 1)/2 + 1) = ((9 + 1)/2 + 1) = (10/2 + 1) = (5 + 1) = 6 The terms are 5th and 6th. Now, T5 = T4+1 = 9C4 (3x)9-4 (x3/6)4 = [Tex]\frac{9×8×7×6}{5×4×3×
15+ min read
Class 11 RD Sharma Solutions - Chapter 18 Binomial Theorem- Exercise 18.2 | Set 3
Question 27. If the 3rd, 4th, 5th and 6th terms in the expansion of (x + α)n be respectively a, b, c, and d, prove that [Tex]\frac{b^2-ac}{c^2-bd}=\frac{5a}{3c} [/Tex]. Solution: We are given, (x + α)n So, T3 = a = nC2 xn-2 α2 T4 = b = nC3 xn-3 α3 T5 = c = nC4 xn-4 α4 T6 = d = nC5 xn-5 α5 We need to prove that, [Tex]\frac{b^2-ac}{c^2-bd}=\frac{5a}{
8 min read
Class 11 RD Sharma Solutions- Chapter 18 Binomial Theorem - Exercise 18.1
Question 1. Using binomial theorem, write down the expressions of the following:(i) (2x + 3y)5 Solution: Using binomial theorem, we have, (2x + 3y)5 = 5C0 (2x)5 (3y)0 + 5C1 (2x)4 (3y)1 + 5C2 (2x)3 (3y)2 + 5C3 (2x)2 (3y)3 + 5C4 (2x)1 (3y)4 + 5C5 (2x)0 (3y)5 = 32x5 + 5 (16x4) (3y) + 10 (8x3) (9y)2 + 10 (4x)2 (27y)3 + 5 (2x) (81y4) + 243 y5 = 32x5 + 2
15 min read
Finding Derivative with Fundamental Theorem of Calculus
Integrals are the reverse process of differentiation. They are also called anti-derivatives and are used to find the areas and volumes of the arbitrary shapes for which there are no formulas available to us. Indefinite integrals simply calculate the anti-derivative of the function, while the definite integrals have limits and usually denote the are
5 min read
Parikh's Theorem
Introduction :Parikh's theorem in theoretical computer science says that if one looks only at the number of occurrences of each terminal symbol in a context-free language, without regard to their order, then the language is indistinguishable from a regular language. It is useful for deciding that strings with a given number of terminals are not acc
5 min read