# Component (thermodynamics)

In thermodynamics, a component is one of a collection of chemically independent constituents of a system. The number of components represents the minimum number of independent chemical species necessary to define the composition of all phases of the system.
Calculating the number of components in a system is necessary when applying Gibbs' phase rule in determination of the number of degrees of freedom of a system.
The number of components is equal to the number of distinct chemical species (constituents), minus the number of chemical reactions between them, minus the number of any constraints (like charge neutrality or balance of molar quantities).

## Calculation

Suppose that a chemical system has M elements and N chemical species (elements or compounds). The latter are combinations of the former, and each species A$_i$ can be represented as a sum of elements:
    $A_{i}=\sum _{j}a_{ij}E_{j},$
where a$_{ij}$ are the integers denoting number of atoms of element E$_j$ in molecule A$_i$. Each species is determined by a vector (a row of this matrix), but the rows are not necessarily linearly independent. If the rank of the matrix is C, then there are C linearly independent vectors, and the remaining N-C vectors can be obtained by adding up multiples of those vectors. The chemical species represented by those C vectors are components of the system.
If, for example, the species are C (in the form of graphite), CO$_2$ and CO, then
    ${\begin{bmatrix}1&0\\1&2\\1&1\end{bmatrix}}{\begin{bmatrix}C\\\\O\end{bmatrix}}={\begin{bmatrix}C\\CO_{2}\\CO\end{bmatrix}}.$
Since CO can be expressed as CO = (1/2)C + (1/2)CO$_2$, it is not independent and C and CO can be chosen as the components of the system.
There are two ways that the vectors can be dependent. One is that some pairs of elements always appear in the same ratio in each species. An example is a series of polymers that are composed of different numbers of identical units. The number of such constraints is given by Z. In addition, some combinations of elements may be forbidden by chemical kinetics. If the number of such constraints is R', then
    $C=M-Z+R'.$
Equivalently, if R is the number of independent reactions that can take place, then
    $C=N-Z-R.$
The constants are related by N - M = R + R'.

## Examples
### CaCO$_3$ - CaO - CO$_2$ system

This is an example of a system with several phases, which at ordinary temperatures are two solids and a gas. There are three chemical species (CaCO$_3$, CaO and CO$_2$) and one reaction:
    CaCO$_3$ ⇌ CaO + CO$_2$.
The number of components is then 3 - 1 = 2.

### Water - Hydrogen - Oxygen system

The reactions included in the calculation are only those that actually occur under the given conditions, and not those that might occur under different conditions such as higher temperature or the presence of a catalyst. For example, the dissociation of water into its elements does not occur at ordinary temperature, so a system of water, hydrogen and oxygen at 25 °C has 3 independent components.

### Aqueous solution of 4 kinds of salts

Consider an aqueous solution containing sodium chloride (NaCl), potassium chloride (KCl), sodium bromide (NaBr), and potassium bromide (KBr), in equilibrium with their respective solid phases. While 6 elements are present (H, O, Na, K, Cl, Br), their quantities are not independent due to the following constraints:
* The stoichiometry of water: n(H) = 2n(O). This constraint imply that knowing the quantity of one determines the other.
* Charge balance in the solution: n(Na) + n(K) = n(Cl) + n(Br). Thin constraint imply that knowing the quantity of 3 of the 4 ionic species (Na, K, Cl, Br) determines the fourth.
Consequently, the number of independently variable constituents, and therefore the number of components, is 4.