Hardy-Weinberg principle says that the sum total of all the allelic frequencies of a gene is 1 and the possible frequencies of above mentioned genotypes, i.e., AA, aa and Aa are p2, q2 and 2pq, respectively. So mathematically this statement can be written as
p2 + 2pq + q2 = 1, where
p2 = Homozygous dominant individuals
2pq = Heterozygous individuals
q2 = Homozygous recessive individuals