Mendelian genetics state that traits are inherited from one generation to the next through genes, which come in two different versions called alleles.
Alleles can be dominant or recessive, the difference being that it only takes one dominant allele to express a dominant trait, but there need to be two recessive alleles in order to express a recessive trait.
Natural selection, on the other hand, states that organisms that have traits which make them better adapted for their environment are more likely to pass on their genes to their descendents.
Hardy and Weinberg realized that dominant and recessive alleles offer variation in a population and that natural selection would act upon that variation, altering the overall frequency of those traits.
So they took the altering factor - natural selection - off the table and came up with the Hardy-Weinberg principle, or equilibrium, which is a hypothetical state of balance in a population, where the frequency of dominant and recessive alleles remains the same from one generation to the next.
So for a population to achieve this balance there have to be no factors altering its genetic composition.
One altering factor is natural selection.
Other factors are mutations - where alleles actually change and become a new variety of a certain trait - and migration - where new and maybe different alleles enter or leave the population causing its composition to change.
Finally, a determining factor is the size of the population - a smaller lot has a greater risk of losing alleles from one generation to the next because some organisms don’t get to reproduce - a process called genetic drift.
If none of these factors affect a population, the genetic pool remains constant.
Now let’s say we have a population with a genetic pool that’s large and stable over time.
And let’s assume that we want to study a specific gene that has only two alleles - dominant “A” and recessive “a”.
Now, we’ll call the frequency or proportion of the dominant allele - “p” and the frequency or proportion of the recessive allele “q”.
Since these are the only two alleles in the population, p + q has to equal 1.
For example, if we know that 75%, or 0.75 of the alleles are dominant, then the remaining 25%, or 0.25 must be recessive alleles, since 0.75 plus 0.25 equals one.
Now, let’s use a Punnett square.
There are only two possible alleles that can be found in the male gamete A and a, and the same is true for the female gamete - A and a.
So in this scenario, the chance of having a dominant “A” allele is 0.75, and the chance of having a recessive “a” allele is 0.25.
So in a population the probability of having two dominant alleles or homozygous dominant, means getting a dominant allele from both the male and the female gamete.
This can be calculated as the probability of having a dominant allele from the male gamete, which is p, multiplied by the probability of having a dominant allele from the female gamete, which is also p.
So that’s p x p or p squared.
Similarly, the probability of having two recessive alleles or homozygous recessive means getting a recessive allele from both the male and the female gamete, and it works out to q x q or q squared.