First, I will state the rule with an applied example.

**Problem Definition****: **Computing the probability that a message containing a given word is spam.

**probability Terminologies:**

**p(S|W)**: is the probability that a message is a spam, knowing that the word “replica” is in it.**p(S)**: is the probability that any given message is spam.**p(W|S)**: is the probability that the word “replica” appears in spam messages.**p(H)**: is the overall probability that any given message is not spam.**p(W|H)**: is the probability that the word “replica” appears in not spam messages.

**The formula used by the software derived from**** Bayes’ theorem**.

p(S|W) = p(W|S) . p(S) **OVER** p(W|S) . p(S) + p(W|H) . p(H)

**Q:** The Question is: How did you get to this Conclusion ?

**A:** Let’s check the conditional Probability rule with an example, First.

**Example: **we have two fair coins the probability of tossing theses coins is distributed like this

First Coin |
Second Coin |
Probability |

H | H | 1/4 |

H | T | 1/4 |

T | H | 1/4 |

T | T | 1/4 |

1- p(Two Heads) = p(HH).

2- p(at Least one Head) = p(HH) + p(HT) + p(TH).

**Now this Question is the conditional Probability: **

what is the probability of getting a Head given we already have one of the two coins is head. this question has changed the sample Space.

**Note: ** in the previous two questions the sample space was the whole possible set of events, but now i’m telling you your new sample space is formed only from the combinations with at least coin with one head. the Count of the sample space is {HH, HT, TH}.

**Then ** p(H| we already have a head) = 1/3 only one possible way which is **HH.**

**The Conditional Probability Rule**:

p(A|B) = p(A and B) **OVER** p(B)

Let’s prove it using simple combinatories

- p(A and B) = number of occurences of Both Events A and B / The Sample space.
- p(B) = number of occurences of Event B / The Sample Space.

** **

**Remeber **Conditional probability Calculates the number of occurences of event A given that Event B is also occured which is the intersection of the Two events [number of occurences of Both A and B] over the changing of the sample space to the number of occurences of event B.

**Calculating** Our rule above gives the desired results.

**The End, **Math is Fun and Pure the moment you try hard to get what it wants to it will always accept you will never be dishonest to you. It’s only impossible when you decides to.