Hardy and Weinberg derived their famous equation by extending Mendel's first law, which is called the Law of Segregation. The Law of Segregation states that during the formation of gametes, the two alleles for each trait segregate or separate from each other, so that each gamete carries only one allele for a particular trait. This law explains how traits are passed from parents to offspring and how genetic variation is maintained in a population. The Hardy-Weinberg equation builds upon this principle to describe the genetic equilibrium in a population under certain assumptions.