In Hardy-Weinberg problems the frequency of a homozygous recessive
genetic occurrence in a population is q2.
Sort of but not quite. If the locus has two possible alleles, $A$ and $a$, the frequency of each allele in the population is $p$ and $q$ respectively. If the population size ($N$) is 500 diploid individuals, there are 1000 loci ($2*N$, because of diploidy) which each could have either $A$ or $a$, and each of the 500 individuals could have the genotypes $AA$, $Aa$, or $aa$. If we know that the population of loci has 100 copies of $A$ then $p = 100/1000 = 0.1$, and $q$, the frequency of $a$, must then be $1-p = q = 0.9$.
The value of $q^2$ tells us how many individuals in the population, under the assumptions of HWE, will be of the genotype $aa$ - it says nothing about the recessivity (or dominance) of the allele, nor the phenotype. In the example above, $q^2 = 0.9^2 = 0.81$ - under assumptions of HWE 81% of the population will be genotype $aa$.
In terms of math it is simple probability theory. If we have a bag of coloured marbles, 5 red and 5 blue, the frequency of red ($p$) is 0.5, and blue ($q$) is 0.5. If we draw one marble from the bag, the probability of the marble being blue, $P(blue)$, is equal to the frequency of blue, $q$, which is 0.5. If we then return the marble to the bag and make a second draw, the probability of drawing a blue marble is again $b$, 0.5. The probability of both of the drawn marbles being blue $P(blue) * P(blue) = 0.5 * 0.5$, or $q^2$. The probability of drawing one red and one blue is $2 * p * q$, and probability of two red marbles is $p^2$.