Valency of an element is the number of electrons lost or gained or shared with other atoms in the formation of compounds.
The electrons that are present in the outermost shell are known as valence electrons.
The valency of representative elements is equal to the number of electrons in the outermost shell for groups 1 and 2, for groups 13 and 14 subtract 10 from group number and 8 minus the number of electrons in the outer most shell for groups 15- 18.
Inert gases like He,Ne,Ar,Kr,Xe, etc ( which are belongs to 18th group elements ) normally do not enter into chemical bonding and hence their valency is zero.
Example 1:
Consider the Lithium atom having an atomic number and it belongs to I A group element
The electronic configuration of Lithium is.
The number of valence electrons in lithium is . Thus, it must lose one to attain stability ( To get more stable electronic configuration of inert gas). Therefore, the valency of Lithium is .
Example 2:
Consider the Nitrogen atom having an atomic number and it belongs to 15 A group element
The electronic configuration of Nitrogen is.
The valency of Nitrogen is 3 as it gains 3 electrons to get more stable inert gas Neon configuration.