Ternary compound

In inorganic chemistry, a ternary compound is a compound containing three different elements. An example is sodium phosphate, Na3PO4. The sodium ion has a charge of 1+ and the phosphate ion has a charge of 3-. Therefore, three sodium ions are needed to balance the charge of one phosphate ion. Another example of a ternary compound is calcium carbonate, CaCO3. In naming and writing the formulae for ternary compounds, rules are similar to binary compounds.
According to Rustum Roy and Olaf Müller, "the chemistry of the entire mineral world informs us that "chemical" complexity can easily be accommodated within structural simplicity." The example of zircon is cited, where various metal atoms are replaced in the same crystal structure. "The structural entity ... remains ternary in character and is able to accommodate an enormous range of chemical elements." The great variety of ternary compounds is therefore reduced to relatively few structures: "By dealing with approximately ten ternary structural groupings we can cover the most important structures of science and technology specific to the non-metallics world. It is a remarkable instance of nature's simplexity."
Letting A and B represent cations and X an anion, these ternary groupings are organized by stoichiometric types A2BX4, ABX4, and ABX3. 
A ternary compound of type A2BX4 may be in the class of olivine, the spinel group, or phenakite. Examples include K2NiF4, β-K2SO4, and CaFe2O4.
One of type ABX4 may be of the class of zircon, scheelite, barite or an ordered silicon dioxide derivative.
In the ABX3 class of ternary compounds, there are the structures of perovskite (structure), calcium carbonate, pyroxenes, corundum and hexagonal ABX2 types.
Other ternary compounds are described as crystals of types ABX2, A2B2X7, ABX5, A2BX6, and A3BX5.
In organic chemistry, the carbohydrates and carboxylic acids are ternary compounds with carbon, oxygen, and hydrogen. Other organic ternary compounds replace oxygen with another atom to form functional groups.