A transformer transfers electrical energy from one circuit to another through electromagnetic induction. It is used to increase or decrease the AC voltage by replacing the secondary coil, maintaining the frequency constant. It consists of two separated windings wrapped around a soft iron core. The primary winding has N_p turns and is connected to an alternating voltage. The secondary winding has N_s turns and is connected to a load resistor. Here, the transformer is considered ideal, with no energy loss, and it is assumed that the same magnetic flux passes through the primary and secondary windings. The AC source, connected to the primary winding, generates an alternating current, which sets up an alternating magnetic flux in the core. This flux induces an emf in each winding. Since magnetic flux is equal through the primary and secondary windings, the ratio of secondary emf to primary emf is equal to the ratio of secondary to primary turns at any instance. If the windings have zero resistance, the induced emf equals terminal voltages, that gives the transformer equation.