How are the values for the resistances and capacitor chosen in the circuit below
R6 and C2 together form a low-pass filter with a time constant of 22.1 &micro;s, which gives a cutoff frequency of about 7200 Hz. This serves to limit the amount of high-frequency powerline noise that gets to the optoisolator. The main concern is to limit false triggering caused by excess dV/dt (fast voltage transients), but without creating so much phase shift that it defeats the zero-crossing feature.

R6 and R7 together serve to limit the peak current through the optoisolator and the gate of the main triac.

It is the combination of these requirements that ultimately dictates the values used for the three components.