Theory:

Let us now see an example to understand how to write a chemical formula for a compound.
Formulae of simple compounds:
The constituent elements and their valencies are written down in the chemical formulae for compounds, as shown below.
The valencies of the combining atoms must then be crossed.
1. Formula of Water.
  
We know the symbol for hydrogen \(H\) and oxygen \(O\).
  
1.png
  
Formula: \(H_2O\)
 
2. Formula of Hydrogen sulphide.
  
We know the symbol for hydrogen \(H\) and sulphide \(S\).
 
2.png
 
Formula: \(H_2S\)
 
3. Formula of Carbon tetrachloride.
  
We know the symbol for carbon \(C\) and chlorine \(Cl\).
 
3.png
  
Formula: \(CCl_4\)
Note: The ions' charges are also not specified in the chemical formula.
1. Formula of Magnesium chloride:
  
We know the symbol for magnesium \(Mg\) and chlorine \(Cl\).
 
4.png
  
Formula: \(MgCl_2\)
  
2. Formula of Aluminium oxide:
  
We know the symbol for aluminium \(Al\) and oxygen \(O\).
 
5.png
  
Formula: \(Al_2O_3\)
  
3. Formula of Calcium oxide:
  
We know the symbol for Calcium \(Ca\) and oxygen \(O\).
 
6.png
  
Formula: \(CaO\)
Note: The valencies of the two elements are the same in this case. You could come up with the formula \(Ca_2O_2\). However, we have shortened the formula to \(CaO\).
4. Formula of Sodium nitrate:
  
We know the symbol for Sodium \(Na\) and nitrate \(NO_3\).
 
7.png
  
Formula: \(NaNO_3\)
  
5. Formula of Calcium hydroxide:
  
We know the symbol for calcium \(Ca\) and hydroxyl groups \(OH\).
 
8.png
  
Formula: Ca(OH)2
Note:
  • The formula of calcium hydroxide is Ca(OH)2 and not \(CaOH_2\). We use brackets when we have two or more of the same ions in the formula. Here it indicates that there are two hydroxyl \((OH)\) groups joined to one calcium atom \(Ca\). And also, remember that brackets are not needed if only one ion is present.
  • It is worth noting that the charges on the ions are not mentioned in the formula.