We can rank the solutions by pH if we know pKa and pKb values of the compounds above. pKa and pKb values can be found in any table of acid and base strength.
Since we have here both acids and bases, we need to transfer pKb values into pKa by subtraction the pKb values from pKw.
HNO3 pKa = -1.37
HCN pKa = 9.21
NH3 pKb = 4.75 pKa= pKw-pKb = 14 - 4.75 = 9.25
Ca(OH)2 pKb = 2.43 pKa= 14 - 2.43 = 11.57
LiOH pKb = -0.36 pKa= 14 - (-0.36) = 14.36
The compound with the smallest value pKa is the strongest acid, and it will have the lowest pH and vice versa.
When we set compounds according to the rule, we obtain the following rank:
HIGHEST pH
LiOH
Ca(OH)2
NH3
HCN
HNO3
LOWEST pH