Recall that Mendel's first law states that for any factor, an individual randomly assigns one of its two alleles to its offspring. Yet this law does not state anything regarding the relationship with which alleles for different factors will be inherited.
After recording the results of crossing thousands of pea plants for seven years, Mendel surmised that alleles for different factors are inherited with no dependence on each other. This statement has become his second law, also known as the law of independent assortment.
What does it mean for factors to be "assorted independently"? If we cross two organisms, then a shortened form of independent assortment states that if we look only at organisms having the same alleles for one factor, then the inheritance of another factor should not change.
For example, Mendel's first law states that if we cross two $$\textrm{Aa}$$ organisms, then $$\frac{1}{4}$$ of their offspring will be $$\textrm{aa}$$, $$\frac{1}{4}$$ will be $$\textrm{AA}$$, and $$\frac{1}{2}$$ will be $$\textrm{Aa}$$. Now, say that we cross plants that are both heterozygous for two factors, so that both of their genotypes may be written as $$\textrm{Aa}\,\textrm{Bb}$$. Next, examine only $$\textrm{Bb}$$ offspring: Mendel's second law states that the same proportions of $$\textrm{AA}$$, $$\textrm{Aa}$$, and $$\textrm{aa}$$ individuals will be observed in these offspring. The same fact holds for $$\textrm{BB}$$ and $$\textrm{bb}$$ offspring.
As a result, independence will allow us to say that the probability of an $$\textrm{aa}\,\textrm{BB}$$ offspring is simply equal to the probability of an $$\textrm{aa}$$ offspring times the probability of a $$\textrm{BB}$$ organism, i.e., 1/16.
Because of independence, we can also extend the idea of Punnett squares
to multiple factors, as shown in the figure below. We now wish to quantify
Mendel's notion of independence using probability.
Two events $$A$$ and $$B$$ are independent if $$P(A\ \textrm{and}\ B)$$ is equal to $$P(A) \cdot P(B)$$. In other words, the events do not influence each other, so that we may simply calculate each of the individual probabilities separately and then multiply.
More generally, random variables $$X$$ and $$Y$$ are independent if whenever $$A$$ and $$B$$ are respective events for $$X$$ and $$Y$$, $$A$$ and $$B$$ are independent (i.e., $$P(A\ \textrm{and}\ B) = P(A) \cdot P(B)$$).
As an example of how helpful independence can be for calculating
probabilities, let $$X$$ and $$Y$$ represent the numbers showing on two
six-sided dice. Intuitively, the number of pips showing on one die should
not affect the number showing on the other die. If we want to find the
probability that $$X + Y$$ is odd, then we don't need to draw a tree
diagram and consider all possibilities. We simply first note that for $$X
+ Y$$ to be odd, either $$X$$ is even and $$Y$$ is odd or $$X$$ is odd and
$$Y$$ is even. In terms of probability, \[P(X + Y\ \textrm{is odd}) = P(X\
\textrm{is even and}\ Y\ \textrm{is odd}) + P(X\ \textrm{is odd and}\ Y\
\textrm{is even})\] Using independence, this becomes \[ P(X\ \textrm{is
even}) \cdot P(Y\ \textrm{is odd}) + P(X\ \textrm{is odd}) \cdot P(Y\
\textrm{is even}) = \left(\frac{1}{2}\right)^2 +
\left(\frac{1}{2}\right)^2 = \frac{1}{2} \] You can verify this result in
the figure below, which shows all 36 outcomes for rolling two dice.
Write a function probability that takes two positive integers $$k$$ and $$N$$. In this problem, we begin with Tom, who in the 0th generation has genotype $$\textrm{Aa}\,\textrm{Bb}$$. Tom has two children in the 1st generation, each of whom has two children, and so on. Each organism always mates with an organism having genotype $$\textrm{Aa}\,\textrm{Bb}$$. The function must return the probability that at least $$N$$ organisms having genotype $$\textrm{Aa}\,\textrm{Bb}$$ will belong to the $$k$$-th generation of Tom's family tree (don't count the $$\textrm{Aa}\,\textrm{Bb}$$ mates at each level). Assume that Mendel's second law holds for the factors.
>>> probability(2, 1) 0.68359375 >>> probability(5, 9) 0.40648834849733051 >>> probability(7, 37) 0.17840828844163573
Two random variables are dependent if they are not independent. For an example of dependent random variables, recall our example in "Mendel's first law" of drawing two balls from a bag containing 3 red balls and 2 blue balls. If $$X$$ represents the color of the first ball drawn and $$Y$$ is the color of the second ball drawn (without replacement), then let $$A$$ be the event "$$X$$ is red" and $$B$$ the event "$$Y$$ is blue".
In this case, the probability tree diagram illustrated in the figure above demonstrates that $$P(A\ \textrm{and}\ B) = \frac{3}{10}$$. Yet we can also see that $$P(A) = \frac{3}{5}$$ and $$P(B) = \frac{3}{10} + \frac{1}{10} = \frac{2}{5}$$. We can now see that \[ P(A\ \textrm{and}\ B) \neq P(A) \cdot P(B) \].