When you boil a molecular substance, you are overcoming the intermolecular bonds. Hence, boiling point depends on the extent of intermolecular bonding.
the more sites for intermolecular bonding, the greater the extent.
We shall only consider H-bonding to determine which compound has the higher boiling point because H-bonding is the strongest among the inter- and intra- molecular bonds. H-bonding refers the attraction of the lone pair on F,O or N to a H attached to another F, O or N atom.
2-hydroxyl-benzoic acid exhibit intra-molecular bonding. The -OH group is situated adjacent to the -COOH group. The hydrogen of the -OH group is exposed to the oxygen atoms of the -COOH group, thus facilitating intra-molecular H-bonding.
In 4-hydroxyl-benzoic acid, the -OH and -COOH groups are projected away from each other. Hence, there can be no intra-molecular H-bonding between them.
consider 4-hydroxyl-benzoic acid:
number of lone pairs on -OH group for inter-molecular H-bonding = 2
number of lone pairs on -OH group for intra-molecular H-bonding = 0
number of lone pairs on -COOH group for inter-molecular H-bonding = 4
number of lone pairs on -COOH group for intra-molecular H-bonding = 0
number of H for inter-molecular H-bonding = 2
number of H for intra-molecular H-bonding = 0
consider 2-hydroxyl-benzoic acid:
number of lone pairs on -OH group for inter-molecular H-bonding = 2
number of lone pairs on -OH group for intra-molecular H-bonding = 0
number of lone pairs on -COOH group for inter-molecular H-bonding = 3
number of lone pairs on -COOH group for intra-molecular H-bonding = 1
number of H for inter-molecular H-bonding = 1
number of H for intra-molecular H-bonding = 1
From the above figures, you can see there are less intermolecular bonding sites for 2-hydroxyl-benzoic acid. Thus, 2-hydroxyl-benzoic acid exhibits less extensive inter-molecular bonding than 4-hydroxyl-benzoic acid. Thus 4-hydroxyl-benzoic acid must have the higher boiling point.