The thermal energy produced for an AC circuit in one time period is given by,H=Irms​2×R×ω2π​ For current, i1​=i0​sinωt ,​Irms​=2​i0​​⇒H=2i0​2R​×ω2π​=ωπi0​2R​​ For current, i2​=−i0​sinωt Irms​=2​i0​​ Hence, the same thermal energy will be produced due to this current.Since, the direction of h and i2​ are opposite and their magnitude is same, the net current through the resistor will become zero when both are passed together. Yes, the principle of superposition is obeyed in this case.