If 40% of all butterflies are white (bb), then the remaining 60% of butterflies must be brown (BB or Bb).
Let p be the frequency of the dominant allele B, and q be the frequency of the recessive allele b.
We know that B is dominant over b, so the frequency of homozygous dominant individuals (BB) is p^2.
We also know that 40% of the population is white (bb), so q^2 = 0.4. Solving for q, we get q = 0.2.
Since p + q = 1, we can solve for p: p = 1 - q = 0.8.
The frequency of heterozygous individuals (Bb) is 2pq = 2(0.8)(0.2) = 0.32, or 32%.
The frequency of homozygous dominant individuals (BB) is p^2 = (0.8)^2 = 0.64, or 64%.