A general theory of the coupling of electromagnetic modes in a nonlinear dielectric or magnetic medium is developed. The rate at which the mode amplitudes change, either in time or in space, is derived by a perturbation method similar to that previously used for stationary perturbations. The technique is illustrated by applying it to the problems of producing harmonic generation and parametric oscillation with a high-power laser, confocal resonator modes being used to describe mathematically both the focused laser beam and the output radiation. A comparison is made of resonant vs nonresonant structures for second harmonic generation, and threshold conditions are obtained for parametric oscillation. In addition, by combining the Manley-Rowe relations with the coupled mode equations, an alternative derivation of the symmetry properties of the nonlinear susceptibility tensor is given.