Contrastive distribution in linguistics, as opposed to complementary distribution or free variation, is the relationship between two different elements in which both elements are found in the same environment with a change in meaning.
In phonology, two sounds of a language are said to be in contrastive distribution if replacing one with the other in the same phonological environment results in a change in meaning. If a sound is in contrastive distribution, it is considered a phoneme in that language.
For example, in English, the sounds [p] and [b] can both occur word-initially, as in the words pat and bat (minimal pairs), which are distinct morphemes. Therefore, [p] and [b] are in contrastive distribution and so are phonemes of English.
Note that two sounds that are in contrastive distribution in one language can be in complementary distribution or free variation in another. These sounds occur in English, as in the word team [tʰiːm] and steam [stiːm], but their occurrence is purely dependent upon phonological context. Therefore, in English, [tʰ] and [t] are not in contrastive distribution but in complementary distribution.
In morphology, two morphemes are in contrastive distribution if they occur in the same environment, but have different meanings.
The change from non-past first-person singular indicative am to the subjunctive were results in a change in the grammatical mood of the sentence.