So Many Antigens, So Little Genome Space
The adaptive immune system is based on one major concept: the recognition of self vs. non-self. This is important because lymphocytes (specifically Memory B-lymphocytes) are already coded to respond to certain antigens and produce antibodies against them, including certain antigens found in the human body itself. The key is that these lymphocytes will recognize those antigen molecules that are a part of the human body to be ‘self’, and will not attack those molecules (This is not always the case, resulting in autoimmune diseases).
B-lymphocytes come pre-coded with the antibody chemistries for each antigen they might ever encounter (the human body does not actually encounter most of the pathogens it has antibodies for), and each B-lymphocyte coded for a different antigen response is stored in a very low concentration throughout the body. When the antigen is present, the specific type of B-lymphocyte multiplies, and when the attack on the antigen is concluded, most of the B-lymphocytes die, with a few remaining behind as memory-B lymphocytes.
Through antigen stimulation, humans are able to produce antibodies, but even without considering antigen stimulation, humans produce more than a trillion different antibodies. To store all this memory for receptors genetically would require millions of genes. However, the entire human genome only consists of 50,000 genes.
To produce so many antibodies and antigen receptors, the antibody genes in the body go through a process named combinatorial diversification. At birth, the human produces a vast array of lymphocytes, each with its own antigen receptor, from a small group of genes. This can occur because segments of genes recombine with other genes in order to produce a new, unique, gene, and hence a unique antigen receptor. See Figure 1.L to see the variable part of the antibody.

Figure 1.L - An Antibody
This recombination allows the body to produce over a trillion antibody molecules without having to store it all in different genes. This also allows a newborn baby instant protection against any diseases it might encounter (because the process has already begun by birth, and the baby has started to gain antibodies. However, the process of this genetic recombination has not ended by birth).

