Not being an electrical engineer, I have always wondered how sources of AC power are matched when joining a common grid. I assume the power is generated at 60 hertz from each source but how is the match made so sources are in phase with one another? For instance, suppose an individual could generate his own electrical power. I have heard of the situation where the unneeded power is passed to the utility company for a credit. I assume the phases must be synchronized. How is this done?