Hardy Weinberg law in genetics

This law concerns the genetic make-up of a population from one generation to the next. It states that in sexually reproducing organisms, in the absence of genetic mutation, factors(called alleles) determining inherited traits are passed down unchanged from generation to generation. We want to show that the law is true. Consider the simple case of only two alleles, A and B, in a gene. The probability of occurrence of the A gene in a population in generation n is Pn, and that of the B gene is Qn. Pn + Qn = 1. These two alleles combine to form in the next generation AA or BB, with probability (P^2)n, (Q^2)n, and 2PnQn, respectively.

a. The probability of the occurence of the A alleles in the n+1 generation is denoted by Pn+1 and that of the B alleles by Qn+1. We write

Pn+1 = f(Pn, Qn), Qn+1 = g(Pn, Qn).

Find the functions f and g.

Hint: The probability of occurence of AA in generation n+1 from generation n is (P^2)n. The probability is 100% that the individual with the AA gene has the A alleles. The probability is only 50% that an individual with the AB gene will contribute an A allele to the next generation.

b. Show that f = Pn and g = Qn, and therefore

Pn+1 = Pn = P and Qn+1 = Qn = Q,

where P and Q are independent of n.

I really need help !!!