Resonance occurs when the right-going waves are in phase. Consider two
consecutive right-going waves and call them wave A and wave B. At any
position on the string, wave B travel a distance of 2L more than wave A, where
L is the length of the string. Thus the path difference between them is 2L. For the two waves to be in
phase, their path difference should be an integer multiple of
l

2L = n l n=
1, 2, 3, ...

Thus, resonance occurs at one of the following wavelengths

Using v = f l, the resonant frequencies are

The same result would be reached if the left-going waves were used.