Reaction of alkyl halide with KCN
KCN is ionic in nature and provides cyanide ions in solution. Although both carbon and nitrogen atoms are in a position to donate electron pairs, the attack takes place mainly
through carbon atom and not through nitrogen atom since C−C bond is more stable than C−N bond.
Involved reaction is shown below:
R−X + K+CN−substitution−−−−−−−→reaction
Alkyl halide
R−CN+KX
Cyanide
Reaction of alkyl halide with AgCN
AgCN is mainly covalent in nature. Here only nitrogen is free to donate electron pair,hence it forms isocyanide as the main product.
Involved reaction is shown below:
R−X + AgCNsubstitution−−−−−−−→reaction
Alkyl halide
R−NC+AgX
Isocyanide
Hence, here isocyanide is formed as major product.