Beating children only teaches them that violence is an appropriate response if you happen to be stronger than your opponent. That's not a very good lesson to teach your kid. For all you know, the kid who insulted you is being raised by abusive parents who beat the hell out of him, which causes his antisocial behavior and prompts him to act out when his parents are not around.
Anyway, there is no reason why you should allow this incident to bother you. It was a small kid, little more than an annoying little dog who barks at you as you walk by. Someone who feels small and vulnerable, and overcompensates by making aggressive noises. Surely you wouldn't want a dog to be beaten by his owner for barking at you, so why would you wish that on a child? He can't hurt you with his noise. The best response is to completely ignore the child. Or, if you really want to teach him a lesson, laugh at him to show him how little this affects you.