Setting Frequency of PWM to 60 Hz

Hello, I am not sure if this question was ask before, but I haven't found it. I am trying to make a digital dimmer with arduino using pwm, the problem is that in order to make my circuit work correctly, I need the arduino pwm frequency to be same than the line frequency (in my case 60 hz I think). If not, something like the next picture happens:

where the red wave is the voltage on the load, and the yellow wave are the pwm pulses
I would appreciate how to do that, thanks

How are you proposing to stay in phase with the AC signal?

Once you figure out the zero crossing detection, take a look at this tutorial and code