The problem
There are two identical motors connected to a source. The first one is connected through a delta-delta transformer and the second one through a delta-wye transformer. The currents of both motors are assumed to contain identical harmonics, especially harmonics of fifth and seventh order. The problem is, why does the current from the source not contain these fifth and seventh harmonics. That is, how and why do the 5th and the 7th harmonics of the two motors cancel?
Currents
Let's say that the current (at the fundamental frequency, without the harmonics) in phase a of the DD-motor is J sin(wt). Then, the corresponding current of the DY-motor is J sin(wt-A), where A = 30 degrees and J is the amplitude of the current. Let the harmonic current of n'th order of motor DD be Jn sin(nwt) in phase a. Then, the corresponding current in the DY-motor is Jn sin(nwt-nA). Note that the phase shift must be nA, in order that the relations between the harmonic current and the fundamental current are the same in both motors.
Phase shift
It is well known, that there is a phase shift of 30 degrees in a DY-transformer. However, it is not physically (or literally) a phase shift generated by some sort of phase shifting circuit. Instead, the phase shift is a result of the subtraction of the currents in the D-windings. If the currents into the delta connected windings (the normal phase currents) are Ia, Ib, and Ic, then the currents in the windings are Iab = (Ia-Ib)/3, Ibc = (Ib-Ic)/3, and Ica = (Ic-Ia)/3. Because the phase differences between the currents Ia, Ib, Ic are 120 degrees, the phase differences between the incoming phase currents and the currents in the windings are +30 or -30 degrees. Note that this phase difference is the same for currents at any frequency, fundamental or harmonic, provided that the phase difference between the incoming currents are 120 degrees.
Phase difference of the harmonics, or positive/negative sequence of the harmonics
In a three phase system, the currents are Ia = J sin(wt), Ib = J sin(wt-F), Ic = J sin(wt+F), where F = 120 degrees. The corresponding harmonic currents are Ina = Jn sin(nwt), Inb = Jn sin(nwt-nF), Inc = Jn sin(nwt+nF). The phase shift is again nF, so that the relations between the fundamental currents and the harmonic currents are the same in all phases. Depending on the value of n, the phase shift nF corresponds to a phase shift of +F or -F, or zero, when the unnecessary 360 degrees have been subtracted. For n=5, nF corresponds to -F so that the harmonic currents are Jn sin(nwt), Jn sin(nwt+F), Jn sin(nwt-F), which corresponds to a negative sequence. For n=7, nF corresponds to +F, i.e. a positive sequence.
The sequence, positive or negative, determines the direction of the phase shift in a DY- transformer, + or - 30 degrees. (Consider the differences Ia-Ib, etc, for the sequences). For harmonics of positive sequence, the phase shift is the same as for the currents of the fundamental frequency, and for harmonics of negative sequence, the phase shift is opposite to that of the fundamental frequency.
The Answer
The current of the 5th harmonics has a phase shift of -150 degrees in the DY motor. When this current goes backwards through the DY-transformer, it experiences a phase shift of -30 degrees, because the current at the fundamental frequency experiences a phase shift of 30 degrees. The sum of -150 and -30 is -180. The corresponding numbers for the 7th harmonics are -210 and +30, and the sum is again -180. QED