When switch $$S$$ is at position $$1$$ for a long time then inductor store energy. $$U=cfrac{1}{2}Li^2$$ $$i=cfrac{E}{R_1}$$ $$U=cfrac{1}{2}Lleft(cfrac{E^2}{R_1^2}\right)$$ When switch $$S$$ is shifted to position $$2$$ then the stored energy in inductor is dissipate in resistor $$R_2$$ Total heat produced in $$R_2=U=cfrac{1}{2}cfrac{LE^2}{R_1^2}$$