The 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 secually reproducing organisms, in the absence of genetic mutation, factors(called alleles) determining inherited traits are passed down unchanged from generation to generation.

Consider the simple case of only two alleles, A and B, in a gene. The probability of occurence 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 or AB, with probability of (P^2)n, (Q^2)n, and 2PnQn, respectevely.

a. The probability of the occurrence 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 allele. 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 have difficulty on even how to start the problem. Help !