In linguistics, complementary distribution, as distinct from contrastive distribution and free variation, is the relationship between two different elements of the same kind, where one element is found in one set of environments and the other element is found in a non-intersecting (i.e. complementary) set of environments. It often indicates that two superficially different elements are the same linguistic unit at a deeper level. It is possible for more than two elements to be in complementary distribution with one another.
Complementary distribution is the distribution of phones in their respective phonetic environments such that one never appears in the same phonetic context as the other. When two variants are in complementary distribution, one can predict where each will occur because one can simply look at the environment in which the allophone is occurring.
Complementary distribution is commonly applied to phonology, where similar phones in complementary distribution are usually allophones of the same phoneme. For instance, in English, [p] and [pʰ] are allophones of the phoneme /p/ because they occur in complementary distribution. [pʰ] always occurs when it is the syllable onset and followed by a stressed vowel (as in the word pin). [p] occurs in all other situations (as in the word spin).
There are cases where elements are in complementary distribution, but are not considered allophones. For example in English [h] and [ŋ] are in complementary distribution, since [h] only occurs at the beginning of a syllable and [ŋ] only at the end. But because they have so little in common in phonetic terms they are still considered separate phonemes. 
The concept of complementary distribution is applied in the analysis of word forms (morphology). Two different word forms (allomorphs) can actually be different "faces" of one and the same word (morpheme). For example, consider the English indefinite articles a and an. The usages an aardvark and a bear are grammatical. But the usages *a aardvark and *an bear are ungrammatical (marked with "*" in linguistics).
- The form an is used "in the environment" before a word beginning with a vowel sound.
- This linguistic environment can be notated as "__ V".
- The form a is used in the environment before a word beginning with a consonant sound.
- This can be notated as "__ C".
- The "distribution" (usage according to environments) of the forms an and a is "complementary" because of three factors ---
- (1) an is used where a is not used;
- (2) a is used where an is not used;
- (3) when you take the environment where an is used, and the environment where a is used, the two environments together cover every legitimate potential environment for the word.
The forms an and a function to work together like a team, in order to take care of every instance (environment) where the English indefinite article is needed. This is why we say that they are two different "forms" of the same "word", instead of saying that they are "two different words".
- An Introduction to Language by Victoria Fromkin