# Journey to Understand Bayes’ Theorem Visually

There is also a possibility for another event B to occur after A and the odds of that are denoted by P(B|A).Since both events occur successively, the probability for this whole timeline to come about(i.e. A and B both occur and B takes place after A) isP(A)⋅ P(B|A)Since we are considering the probability for A and B both to occur, it can also be interpreted as P(A ∩ B)Intersection Rule (A ∩ B)Hence,P(A ∩ B) = P(A)⋅ P(B|A)Here P(B|A) is known as the conditional probability and consequently, can be simplified toP(B|A) = P(A ∩ B)/P(A), Assuming that P(A) ≠ 0Note that the above case is only valid if the events occur successively and are codependent on each other..There can also be a possibility that A doesn’t influence B, If so, then these events are independent of each other and are called Independent EventsIndependent EventsIn the case of Independent events, the odds of A to occur doesn’t affect the odds of B to occur, therefore.P(B|A) = P(B)Law of Total ProbabilityThe Law of total probability divides the calculations into different parts..It is used to find the probability of an event which is codependent on two or more events that occur prior to the former event.Too abstract?.Let’s try a visual approachTotal Probability DiagramLet B be an event which can occur after any of the “n” events(A1, A2, A3,…….. An)..As defined above P(Ai ∩ B) = P(Ai)⋅P(B|Ai) ∀ i ∈[1,n]Since the events A1, A2, A3, …..An are mutually exclusive and cannot occur at the same time and we can reach B either through A1 or A2 or A3 or…… or An..Therefore the rule of sum dictatesP(B) = P(A1 ∩ B) + P(A2 ∩ B) + P(A3 ∩ B) + ……+ P(An ∩ B)P(B) = P(A1)⋅ P(B|A1) + P(A2)⋅ P(B|A2) + ……+ P(An)⋅ P(B|An)The above expression is called Total Probability Rule or Law of Total Probability..This can also be explained using Venn Diagrams.Bayes’ TheoremBayes’ Theorem is a method of predicting the origin or source based on the prior knowledge of certain probabilitiesWe already know P(B|A) = P(A ∩ B)/P(A), Assuming that P(A) ≠ 0 for two codependent events..Ever wonder what P(A|B) =?, Semantically it doesn’t make any sense since B occurs after A and the timeline cannot be reversed (i.e we cannot travel upwards from B to START)Mathematically we know according to the conditional probabilityP(A|B) = P(B ∩ A)/P(B) , Assuming that P(B) ≠ 0P(A|B) = P(A ∩ B)/P(B) , as P(A ∩ B) = P(B ∩ A)and we know thatP(A ∩ B) = P(B|A)⋅ P(A)Substituting values we getP(A|B) = P(B|A)⋅ P(A)/P(B)This is the simplest form of Bayes’ Theorem.Now, assume that B is codependent on multiple events that occur prior to it..Applying Total Probability Rule to the above expression we getP(Ai|B) = P(B|Ai)⋅ P(Ai)/(P(A1)⋅ P(B|A1) + …… More details