OK, my knowledge of genetics is infinitesimal, but here is my take.
An organism contains two copies of the gene in question, and each copy can be in one of two variants, or forms, or alleles: A and B. Suppose there is a population of organisms. Take a random organism and then take one of the two copies of the gene; the probability that this copy is A is p, and the probability that the copy is B is q = 1 - p. In other words, the probability that any given gene has allele (form) A is p and the probability that is has form B is q.
During reproduction, the child randomly receives one copy of the gene from each parent, so the child again has two copies. It is stated as a hint that if in the parent population the probabilities of alleles A and B are p_n and q_n, respectively, then the probability that a child has two gene copies of allele A is , the probability that a child has one A and one B is , and the probability of BB is .
Suppose the (n+1)st generation has N organisms. Then there are organisms with two A genes, with one A and one B gene, and organisms with two B genes. The total number of genes is . The number of A genes is ; therefore, the probability of the A gene in the (n+1)st generation is . Similarly, the probability of the B gene is . Therefore, and .