In population A there are 525 teeth and out of these, 114 have cavities, thus 21.71%.

In population B there are 413 teeth and 50 have cavities, thus 12.10%.

Which statistical function would I use to determine if the difference between the two populations is statistically significant? From what I can tell, a chi square test would work, but I am not sure. After fudging around with the numbers in a horrible medley of chi-square formulas, I've determined that there is statistical difference between the two groups, but none of my results match one another so I'm pretty lost...

Any help would be greatly appreciated, please let me know if any other data would be helpful or necessary.