When two or more atoms combine chemically, they form a molecule. A molecule is the smallest unit of a compound that retains the chemical properties of that compound. It is composed of two or more atoms held together by chemical bonds.
Chemical bonds can form through different types of interactions between atoms, such as sharing of electrons (covalent bonding) or transfer of electrons (ionic bonding). In covalent bonding, atoms share one or more pairs of electrons to achieve a stable electron configuration. This is commonly observed in molecules consisting of nonmetal atoms, such as oxygen (O2), water (H2O), or methane (CH4).
In ionic bonding, electrons are transferred from one atom to another, resulting in the formation of ions. Ions are electrically charged particles. Positively charged ions are called cations, while negatively charged ions are called anions. Ionic bonds are typically formed between a metal and a nonmetal atom, as the metal atom tends to lose electrons and the nonmetal atom tends to gain electrons. Examples of ionic compounds include sodium chloride (NaCl) and calcium carbonate (CaCO3).
It's important to note that not all combinations of atoms result in the formation of stable molecules or compounds. Some combinations may result in temporary or unstable arrangements and quickly dissociate or undergo chemical reactions.