An electrical device transforming electrical energy into mechanical energy is known as a DC motor. It consists of a stationary part, the stator, and a rotating part, the rotor. In motors, each wire loop is in a magnetic field; when current flows through the loop, the forces on the wire closest to the magnetic poles are directed in opposite directions, as determined by the right-hand rule. The magnetic field applies torque, which causes the shaft to rotate. Consider a rectangular current-carrying loop of wire with sides of lengths a and b in a uniform magnetic field. Recalling the magnetic force on a straight current-carrying wire equation, the magnetic force on side 1 and side 3 can be calculated, and the direction can be determined using the right-hand rule. Similarly, the current on sides 2 and 4 are perpendicular to the magnetic field, and thus, the forces on these sides can be determined. Finally, the net force on the loop can be calculated by adding all the forces on each side of the loop.