If there is one gene with two alleles and we let p be the frequency of the dominant allele and q be the frequency of the recessive allele in the population, then the sum of the frequencies for the two alleles equals one: p + q = 1
If we square both sides of the equation, we get:
p + q = 1
(p + q)^2 = 1^2
(p + q)^2 = 1
p^2 + 2pq + q^2 = 1, where p^2 is the frequency of dominant homozygotes in the population, 2pq is the frequency of heterozygotes and q^2 is the frequency of recessive homozygotes in the population.
So, in your population, there are 1000 individuals, 510 of whom show the dominant trait and they are either dominant homozygotes or heterozygotes. Therefore, 1000 - 510 = 490 individuals show the recessive trait. So, since q^2 is the frequency of recessive homozygotes in the population, then:
q^2 = 490/1000 = 0.49
q = 0.7
Since p + q = 1, then
p + q = 1
p = 1 - q
p = 1 - 0.7
p = 0.3
So, the frequency of dominant homozygotes is p^2 = 0.3 x 0.3 = 0.09 and so 0.09 x 1000 = 90 individuals are homozygous dominant.
The frequency of heterozygotes is 2pq = 2 x 0.3 x 0.7 = 0.42, so 0.42 x 1000 = 420 individuals are heterozygous.