Theory:

A compound's chemical formula is a symbolic representation of its composition. First, we should learn about the symbols and valency of the elements to write a chemical formula of a compound
  
shutterstock_289503659.jpg
 
Let us take, for instance, the comparison between humans and octopuses. Humans have two arms with which they grab things they need.
 
shutterstock_291282713.jpg
 
Likewise, the octopus has eight arms; they can take or hold more compared to humans. Likewise, atoms of different elements have different capacity.
Valency:
Valency is also called the combining capacity of an element. The valency of an element can be used to determine how its atoms can react with the atom(s) of another element to form a chemical compound.
shutterstock_1698678643.jpg
Ozone
 
shutterstock_1800064075.jpg
Water
 
If we want to take any material, we use our hands to take it. Similarly, the valency electron in the atoms is readily available to make a chemical reaction with other atoms or compounds.
 
shutterstock_1703969122.jpg
Ions must be balanced
Rules should be followed to write a chemical formula:
1. The charges (\(+\), \(- \)) or valency (free electrons) on the ion must be balanced.
 
2. When writing a compound of metals and non-metal, the symbol of metal should be written first (left side) and followed  by the non-metal compound (right side).
Example:
\(NaCl\) : Here, Sodium \(Na\) is the metal so that should be written on the left side, and chlorine \(Cl\) is a non-metal that should be written right side.
3. Ions should be enclosed in a bracket before writing the number to indicate the ratio.
 
Let us now we see how to write a chemical formula with some examples to understand it clearly in the next topic.