- Potassium cyanide (KCN) reacts with haloalkanes (R-X) in a nucleophilic substitution reaction, where the cyanide ion (CN\(^-\)) attacks the electrophilic carbon in the C-X bond, displacing the halide ion (X\(^-\)) and forming an alkyl cyanide (R-CN). The product is a simple alkyl cyanide.
- Silver cyanide (AgCN), on the other hand, forms an isocyanide (R-NC) when it reacts with haloalkanes. The difference arises because in the presence of silver, the cyanide ion exists as a complex with Ag\(^+\), making it more likely to attack the carbon from the nitrogen side, leading to the formation of an isocyanide (also known as isonitrile). In this reaction, the CN\(^-\) group attaches to the carbon in a different orientation than in the case of KCN.