Can i adjust a pattern to knit it on smaller needles?

hi!
i have a pattern for a baby hat that calls for 84 stitches to be cast on, with a guage of 5 stitches per inch on size 6 needles. i want to knit it on size 2 needles with a smaller yarn that knits up at 9 stitches per inch on my 2s. (i’ve already knit something else with this yarn on my 2s, and i loved the feel of the knit afterwards, that’s why i want the hat the same)
here’s my question: if 84 stitches divided by 5 per inch equals 16.8 inches in the original pattern, can i multiply my 9 per inch by 16.8 inches to get the new cast on number of 151? the decrease is very simple, i could definitely figure it out for a different cast on number, so i’m not worried about that, i’m just wanting to know if people think this is the right way to go about it in general.
any advice?
thanks!
~heidi

Yes, you’ve got the math right. If there’s ribbing though, you will need to either add or subtract one stitch for that to work out even.