A transistor works when the electrons and the holes start moving across the two junctions between the n-type and p-type silicon. ... By turning a small input current into a large output current, the transistor acts like an amplifier. But it also acts like a switch at the same time.