The second principal function of a transistor, after amplification, is its use as a switch. As you probably know by now, (see semiconductor triodes if you don't) transistors have three electrodes and so two p-n junctions. These p-n junctions can boost or oppose the flow of current. In modern transistors the functioning of the p-n junction can be controlled by properly affecting the voltages. Advanced graphs and equations are required to give the exact relations between the voltages and the state (biasing) of the junction.

However, these two junctions can together exhibit four states (each one can be either forward or reversed biased, as explained in the semiconductor diodes section of this sight):

1. One is forward-biased (boosts the flow of current) and other is reverse-biased (Opposes the flow of current) This is used in amplification.
2. One is reverse and other is forward biased. Also used for amplification
3. Both are forward biased. Full possible current flows
4. Both are reverse biased. No current flows

The working of the transistor as a switch is thus very simple. As you can see by the last two options, the transistor's two junctions can be manipulated to switch between full current and no current. This is the work of a switch, turning the current on and off. This function is useful in the working of modern computers.

The Binary System

Switches, as mentioned, have an important role to play in computers, where they work together with the well-known binary coding system. In binary, a switch that is on is represented by a 1 and one that is off is given the value 0. Thus by combining these on and off switches, we shall obtain combinations of 1 and 0. This is how the chips interpret binary language. And each binary number has a specific meaning. For instance, the binary number 1000001 is the representation of the letter A that is displayed on the screen. 1000010 means the letter B and so on. All these on and off switches are controlled by manipulating transistors in the computer with specific voltages.

The importance of binary system and the switches can be explained as below. Suppose there are seven switches in a room. Each for one bulb. The bulbs have following powers:

64W 32W 16W 8W 4W 2W 1W

26     25     24     23    22   21    20

Suppose that the user wants a total power of 100W. The effective combination would be 64W + 32W + 4W. So he will tell his friend to turn on the 64W, 32W and 4W bulbs. Or he can write a combination for the switches as On,On,Off,Off,On,Off,Off. If On=1 and Off=0, then he can further simplify it as 1100100. Thus, by proper knowledge of switches and the numbers, his friend can obtain the desired power, without bothering about the actual values or anything.

Everything on a computer is stored in binary format. All the data on your hard drive is made up of 0's and 1's, and this is just how the transistors help as switches. With the use of the voltages, the transistors are turned on and off, and when a proper combination is obtained, the desired value can be located.