MathProbabilityEvents and probabilities

Dependence and independence of events

13 minutes read

The patterns we see in data can sometimes be misleading.

For example, if you flip a coin and get tails half of the time, but on one day you only seem to get tails, it can be tempting to believe that the next flip is more likely to be heads. This is an example of the gambler's fallacy — a belief that a certain event is more or less likely to occur due to the past events. In reality, assuming the coin in fair, flips are independent of each other and past results do not affect future outcomes.

To understand this concept better, we will learn about the dependence and independence of events.

Definitions of Independence and Dependence

Let's start with two events:

AA – "It will rain today"

BB – "Random milk chocolate egg has a toy I still didn't have"

We consider probabilities P(A)\mathbb P(A) and P(B)\mathbb P(B) non-zero as favorable outcomes. Two numbers P(A)\mathbb P(A) and P(B)\mathbb P(B) aren't going to be related: even if it rains today, this would not automatically mean I would get the toy I want. And vice versa: if I get the toy I need, I can't be sure if it rains today.

Suppose a box consists of 77 white marbles and 33 black marbles. We already know that the probability of picking a white marble on one try is P(get white)=0.7P(get\ white) = 0.7 and a black one is P(get black)=0.3P(get\ black) = 0.3. But what if two marbles are picked one after the other? In that case, there is a dependency between the probabilities of picking white and black. Imagine that the first draw resulted in a white marble. So now we can pick black marble with probability 39=13\dfrac39=\dfrac13 (the total number of marbles has decreased to 101=910-1=9 after the first try). But if the first draw resulted in a black marble, the probability of getting a white one on the next draw is 79\dfrac79.

Two different examples prompt the following definition:

Two events are called independent if an occurrence of one of them (with positive probability) can't exclude an occurrence of another one (also with positive probability). They are called dependent otherwise.

The concept of independence can be expressed using conditional probabilities.

Conditional probability is the probability of event AA occurring given that event BB has already occurred with non-zero probability. Referring to the marble problem, AA — "The second draw resulted in a white marble", BB — "The first draw resulted in a black marble", and P(AB)\mathbb P(A |B) — the probability to pick a white marble after picking a black one. It is calculated by dividing the probability of both events happening simultaneously by the probability of event BB happening: P(AB)=P(AB)P(B)\mathbb{P}(A | B) = \frac{\mathbb{P}(A \cap B)}{\mathbb{P}(B)}Let's use this formula to formulate a mathematical expression of independent variables. If two events are independent, like in the rain & chocolate egg case, the probability of the event AA — "It will rain" occurring remains unchanged, regardless of whether the event BB — "Random chocolate egg has the toy we need" has occurred or not. In mathematical terms for P(AB)\mathbb P(A \cap B) — the probability of rain is conditional that we got the toy, this is expressed as follows: P(A)=P(AB)P(B)\mathbb{P}(A) = \frac{\mathbb{P}(A \cap B)}{\mathbb{P}(B)}

Both sides of this formula can be multiplied by P(B)\mathbb P(B):

P(A)P(B)=P(AB)P(B)P(B)\mathbb{P}(A)\cdot \mathbb{P}(B) = \frac{\mathbb{P}(A \cap B)}{\mathbb{P}(B)}\cdot \mathbb{P}(B) On the right side P(B)\mathbb{P}(B) cancels out, leaving only P(AB)\mathbb{P}(A \cap B):

P(A)P(B)=P(AB)\mathbb{P}(A)\cdot \mathbb{P}(B) = \mathbb{P}(A \cap B)Using this result, we are now ready to define the more rigorous expression for independence.

Events AA and BB are independent, if and only if P(A)P(B)=P(AB)\mathbb{P}(A) \cdot \mathbb{P}(B) = \mathbb{P}(A \cap B). They are dependent otherwise.

Gambler's fallacy: two coins

Let's use our new definition to disprove gambler's fallacy. To demonstrate the independence of a coin flip, consider events AA (getting heads on the first flip) and BB (getting tails on the second flip). It is important to mention that the coin is fair, so the probabilities of getting a head and tail are equal, and it is 12\dfrac{1}{2}. To find the combined probability, there are four possible outcomes: heads followed by heads, heads followed by tails, tails followed by heads, and tails followed by tails. Only the second outcome (heads followed by tails) satisfies both events. Therefore, P(AB)=14\mathbb{P}(A \cap B) = \dfrac{1}{4}. The picture below describes all reasoning. To define all probabilities, we mark all numerators as sets of desired outcomes and denominators as sets of possible outcomes, next counting them.

probabilities and all possible states when flipping two coins

By plugging these values into the formula, P(A)P(B)=1212=14\mathbb{P}(A) \cdot \mathbb{P}(B) = \dfrac{1}{2} \cdot \dfrac{1}{2} = \dfrac{1}{4}. But we have already got the same result above by counting possible outcomes. Now it can be seen that the events AA and BB are independent. This means that if heads are obtained on the first flip, the result of the second flip won't be influenced in any way. This calculation can also be performed the other way around with the same result.

Gambler's fallacy: three coins

Consider we flip three different coins. All possible outcomes for HH- head and TT- tail are:HHH, HHT, HTH, HTT, THH, THT, TTH, TTTHHH,\ HHT,\ HTH,\ HTT,\ THH,\ THT,\ TTH,\ TTT. What is the probability that the first coin comes up heads? Well, for two-sided coins, the probabilities of getting head or tail are equal, and it's 12\dfrac12. We can claim this more formally — by counting outcomes when HH goes first: HHH, HHT, HTH, HTTHHH,\ HHT,\ HTH,\ HTT, and P(first coin came up H)=48=12P(first\ coin\ came\ up\ H) = \dfrac48 = \dfrac12.

But suppose now that someone told us that only two of three coins have already come up heads. Now what is the probability that the first coin went heads? The key point is that these questions are completely different. If only two of three coins came up heads, we get a new set of possible outcomes: HTH, THH, HHTHTH,\ THH,\ HHT. Only two of them require "First coin came up HH". Therefore, if we know that two out of three coins were heads, then the probability P(first coin came up H)P(first\ coin\ came\ up\ H) is equal to 23\dfrac23. To differentiate the two situations, they write the second case as

P(first coin came up H  two out of three coins came up H)=23P(first\ coin\ came\ up\ H\ | \ two\ out\ of\ three\ coins\ came\ up\ H)=\dfrac23

We also can get the same result using the formula of conditional probability:

P(AB)=P(AB)P(B)=P(first coin came up H)P(two coins came up H)=P({HHT, HTH})P({HHT, HTH, THH})=2/83/8=23\mathbb{P}(A | B) = \dfrac{\mathbb{P}(A \cap B)}{\mathbb{P}(B)}=\dfrac{\mathbb P(first\ coin\ came\ up\ H)}{\mathbb P(two\ coins\ came\ up\ H)}=\dfrac{\mathbb P(\{HHT,\ HTH\})}{\mathbb P(\{HHT,\ HTH,\ THH\})}=\dfrac{2/8}{3/8}=\dfrac23

Continuing for nn coins, remember that there are 2n2^n possible outcomes, and calculating the probability for nn coins may be faster without naming all outcomes.

Independence and complements

Proving independence can sometimes be easier using the complement of an event.

The complement of an event AA, denoted as ACA^C, includes all outcomes in the sample space that are NOT part of AA. The relationship between the event and its complement is defined by P(A)=1P(AC)\mathbb{P}(A) = 1 - \mathbb{P}(A^C), or P(A)+P(AC)=1\mathbb P(A)+\mathbb P(A^C)=1.

For example, 33 out of 1010 light bulbs don't work. Let AA be an event "Random light bulb doesn't work", therefore the complement ACA^C is "Random light bulb works". If 33 out of 1010 don't work, then 103=710-3=7 light bulbs work. Probabilities of AA and ACA^C are 0.30.3 and 0.70.7, or if we already knew P(A)=0.3\mathbb P(A)=0.3, according to the formula above P(AC)=10.3=0.7\mathbb P(A^C)=1-0.3=0.7.

As you can see, the probability of the event is equal to the full sample space minus the probability of its complement:

probability of complement properties

To visualize it for two independent events AA and BB use Euler's diagram below:

independent events and their complements as Euler diagrams

For two independent events, their complements have special properties as follows:

If events AA and BB are independent, their complements ACA^C and BB, AA and BCB^C, ACA^C and BCB^C are independent.

Technical proof of this fact can be overwhelmingly tedious. To understand this visually, consider the Euler diagrams of two independent events. They have a bizarre property: the ratio of the area of event AA to the full event space is equal to the ratio of the area of ABA \cap B to the area of event BB. This is a graphical representation of the independence formula using conditional probabilities: P(A)1=P(AB)P(B)\frac{\mathbb{P}(A)}{1} = \frac{\mathbb{P}(A \cap B)}{\mathbb{P}(B)}

calculating independence formula using euler diagrams and ratios

It may seem confusing at first glance, but this way of proof is quite straightforward. Cross multiplicational rule works for the equation of two fractions, so just imagine that we "multiply" the first fraction's numerator by the second fraction's denominator and compare it to the product of the first fraction's denominator and the second fraction's numerator. In our case, the result of "multiplication" is a common colored part of two diagrams, and the statement is proved if two products are equal.

This visual representation of independent events seems convincing. Taking the complement of one or both events will not affect the size of the circles. For instance, let's consider the complement of event AA:

Effect of applying complement properties for two events and their ratios

The picture remains unchanged, but the numerators in the equation have switched. If the original equation was correct, it still holds true. Now, let's consider the complement of event BB:

Reversed effect of applying complement properties for two events and their ratios

From a visual perspective, it yet again seems alright. Now let's try complementing both events:

Complementing both events and the effect it has on the ratio

The equation holds even when both events are complemented, as the bigger denominator matches the bigger numerator.

Disjoint and independent events

Talking about independent events, there is another important event type we need to mention:

Events AA and BB are called disjoint, if and only if P(AB)=0\mathbb{P}(A \cap B) = 0.

Suppose we roll two six-sided dice. The first dice has numbers from 11 to 66, the second dice has numbers from 77 to 1212. For two rolls at the same time, the probability of coming up with two equal numbers is 00. Events A —A\ — "First dice's outcome" and B —B\ —"Second dice's outcome" are disjoint: their outcome sets don't have common elements.

On Euler's diagram, two disjoint events are represented as two circles without a common area:

Euler diagram of disjoint events shows no intersection between events A and B

Although often confused, disjoint and independent events are very different things. Disjoint events never occur at the same time. Independent events do, but they do not influence each other's probabilities. Regular events have no explicit connection between the product of their probabilities and the probability of their mutual occurrence. This animation illustrates the difference:

Animation with disjoint and independent events

  1. Disjoint events: P(A), P(B) are random numbers, P(A∩B) is always 0
  2. Independent events example: Product of P(A) and P(B) is always equal to P(A∩B)
  3. Regular events example: Probabilities P(A), P(B) and P(A∩B) are random and aren't in a relationship

There is one particular connection between dependent and disjoint events.

If P(A)0\mathbb{P}(A) \neq 0 and P(B)0\mathbb{P}(B) \neq 0, two disjoint events AA and BB are dependent.

This connection is quite straightforward to prove. For two disjoint events AA and BB, If P(A)0\mathbb{P}(A) \neq 0 and P(B)0\mathbb{P}(B) \neq 0, their product P(A)P(B)\mathbb{P}(A) \cdot \mathbb{P}(B) is not equal to zero:

P(A)P(B)0\mathbb{P}(A) \cdot \mathbb{P}(B) \neq 0By definition of disjoint events:

P(AB)=0\mathbb{P}(A \cap B) = 0

P(A)P(B)P(AB)\mathbb{P}(A) \cdot \mathbb{P}(B) \neq \mathbb{P}(A \cap B)Hence, the events are dependent.

Types of independence

All this time, we have been talking about pairs of events. But what if you wanted to check three or more events for independence? Turns out, events can be independent in two distinctly different ways: they can either be pairwise independent or mutually independent from each other. Let's see how that can be expressed mathematically:

Events A1, A2, , AnA_1,\ A_2,\ \dots,\ A_n are pairwise independent if and only if for any two events AiA_i and AjA_j

P(Ai)P(Aj)=P(AiAj), ij\mathbb{P}(A_i) \cdot\mathbb{P}(A_j) = \mathbb{P}(A_i \cap A_j),\ i \neq j

In simple terms, events are pairwise independent if all the pairs of events are independent. For example, a set of events A1, A2, A3A_1,\ A_2,\ A_3 is going to be pairwise independent if and only if 33 following conditions are true:

P(A1)P(A2)=P(A1A2)P(A1)P(A3)=P(A1A3)P(A2)P(A3)=P(A2A3)\mathbb{P}(A_1) \cdot\mathbb{P}(A_2) = \mathbb{P}(A_1 \cap A_2)\\ \mathbb{P}(A_1) \cdot\mathbb{P}(A_3) = \mathbb{P}(A_1 \cap A_3)\\ \mathbb{P}(A_2) \cdot\mathbb{P}(A_3) = \mathbb{P}(A_2 \cap A_3)

Finally, events are mutually independent if every event is independent of any intersection of the other events. To be more formal,

events A1, A2, , AnA_1,\ A_2,\ \dots,\ A_n are mutually independent if and only if for every number 1kn1 \leqslant k \leqslant n and for every subset B1, B2, , BkA1, A2, , AnB_1,\ B_2,\ \dots,\ B_k \subset A_1,\ A_2,\ \dots,\ A_n

i=1kP(Bi)=P(i=1kBi)\prod_{i=1}^k\mathbb{P}(B_i) = \mathbb{P}(\bigcap_{i=1}^k B_i)

\bigcap is a fancy sign for multiple element intersection, like \sum for a sum or \prod for a product.

A set of events A1, A2, A3A_1,\ A_2,\ A_3 above is going to be mutually independent if and only if 44 following conditions are true:

P(A1)P(A2)=P(A1A2)P(A1)P(A3)=P(A1A3)P(A2)P(A3)=P(A2A3)P(A1)P(A2)P(A3)=P(A1A2A3)\mathbb{P}(A_1) \cdot\mathbb{P}(A_2) = \mathbb{P}(A_1 \cap A_2)\\ \mathbb{P}(A_1) \cdot\mathbb{P}(A_3) = \mathbb{P}(A_1 \cap A_3)\\ \mathbb{P}(A_2) \cdot\mathbb{P}(A_3) = \mathbb{P}(A_2 \cap A_3)\\ \mathbb P(A_1) \cdot \mathbb P(A_2) \cdot \mathbb P(A_3)=\mathbb P(A_1 \cap A_2 \cap A_3)

Usually, when mathematicians talk about independence without specifying "pairwise independence", they mean mutual independence. A mutual independence is a stronger requirement: there are problems when any two out of 33 events are independent, but all events are not independent, therefore they can not be mutually independent. Moreover, mutual independence is a more restricting requirement because even for a set of 44 events it asks for the independency of each pair, triple, and quartet.

Conclusion

Dependent events influence each other's probabilities, independent events don't. Whether you remove excessive variables from your mathematical model or just flip a coin, differentiating between the two comes in handy. Here are some key points:

  • Events AA and BB are called independent, if, and only if P(A)P(B)=P(AB)\mathbb{P}(A) \cdot \mathbb{P}(B) = \mathbb{P}(A \cap B). They are called dependent otherwise.

  • The relationship between the event and its complement is defined by P(A)=1P(AC)\mathbb{P}(A) = 1 - \mathbb{P}(A^C). If events AA and BB are independent, their complements ACA^C and BB, AA and BCB^C, ACA^C and BCB^C are independent.

  • Events AA and BB are called disjoint, if and only if P(AB)=0\mathbb{P}(A \cap B) = 0. Two disjoint events with non-zero probabilities are dependent.

  • For more than two events, there are two kinds of independence: pairwise independence and mutual independence. Events are pairwise independent if all the pairs of events are independent. Events are mutually independent if every event is independent of any intersection of the other events.

4 learners liked this piece of theory. 0 didn't like it. What about you?
Report a typo