Semiconductors contain electrons and holes, that is, both positive and negative charge carriers. When a current flows through a bar of semiconductor in the presence of a magnetic field, the charges drift, not only in the direction of the applied electric field, but also perpendicular to the applied magnetic field in accordance with the Lorentz force. This gives rise to a voltage difference V between the upper and lower electrodes as given above.