One of the unusual features of the M n+1 AX n phases ͑where M is a transition metal, A is a group A element, X is carbon or nitrogen, and n =1,2,3. . .͒ is that for a given M-A-X system, only certain values of n are found to occur and there is no systematic behavior between the different systems. Density-functional theory was used to verify the stability of the different phases by comparing their total energy to that of the appropriate competing phases. Five systems ͑Ti-Al-C, Ti-Si-C, Ti-Al-N, Ti-Si-N, and Cr-Al-C͒ were studied for n =1-4. Complete agreement with observed occurrences of these phases was found. Very small energy differences suggest that it may be possible to fabricate Ti 2 SiC, Ti 2 SiN, and Ti 3 AlN 2 as metastable phases. None of the M 5 AX 4 phases were predicted to occur and in all cases the ␣ phases were found to be more energetically favorable than the  phases.