Primer on Bipolar Junction Transistors
This Demonstration shows the operation of an npn bipolar junction transistor as a switch or signal amplifier. Most of the latest transistors, such as MOSFETs, are of the field-effect type, but junction transistors provide a simpler introduction to the basic concepts.[more]
The first graphic shows an npn transistor as a component of an integrated circuit. Three terminals, the collector (C), base (B), and emitter (E), connect to external circuits. The emitter and collector are in contact with layers of n-type silicon—this is Si doped with P (or As or Sb) atoms, so that excess nonbonded electrons can act as negative (n) current carriers. The gate is in contact with a very thin layer (~.01mm) of p-type silicon—Si doped with an electron-deficient impurity, such as B, Ga, or Al, so that any current is carried largely by electron vacancies, which act as positive (p) holes. In the absence of any external input, the E-B interface acts as an n-p diode, and when maintained with a small reverse bias (so that there is a depletion zone around the junction) the transistor behaves as an insulator. The free electrons are shown in the graphic as small red dots, while the holes are represented by white dots. Even in the quiescent mode the electrons and holes diffuse within their layers. You can simulate the dynamic behavior using the "time" slider.
When a small current is applied between B and C, a much larger current surges through the transistor, the output signal increasing with the input signal, often at an exponential rate. The ratio of input to output currents is called the gain, and is typically in the range of several hundred. The graphic shows the electrons migrating toward the emitter. Recall that the conventional current is in the opposite direction to electron flow (thanks to Benjamin Franklin).
The second graphic shows the transistor in a simplified circuit, in which it can amplify an input signal to a much higher amplitude. To function efficiently, the circuit should also contain several additional resistors and capacitors, which are omitted for simplicity. The current flow is tracked by blue arrows. Note that these are more intense in the output circuit. The signal to be amplified is a simple sine wave .
An amplifier can also be based on an analogous pnp transistor, with the output currents then running in the opposite directions.[less]
 Wikipedia. "Transistor." (Sept 5, 2013) en.wikipedia.org/wiki/Transistor.
 Wikipedia. "Bipolar Junction Transistor." (Aug 21, 2013) en.wikipedia.org/wiki/Bipolar_junction_transistor.