In organic compounds, nitrogen, sulphur and halogens are covalently bonded. Their detection in 'Lassaigne's test' is possible if they are in the ionic form. This can be achieved by fusing the organic compound with sodium metal.
Chemistry for test for nitrogen:
Sodium fusion extract is boiled with ferrous sulphate and acidified with sulphuric acid. Sodium cyanide reacts with ferrous sulphate and forms sodium hexacyanoferrate(II). On heating with sulphuric acid, some ferrous is oxidized to ferric hexacyanoferate (II) Fe4[Fe(CN)6]3 which is prussian blue in colour.
Chemistry of the test for sulphur:
Acetic acid is added to sodium fusion extract. complete precipitation of sulphur in the form of lead sulphate occurs which is black in colour. Also, the sodium fusion extract is treated with sodium nitroprusside to obtain violet color. However if N and S are present, then instead of NaCN, NaSCN is obtained. This gives blood red colour on reaction with Fe3+ ions.
Chemistry of test for halogens:
Sodium fusion extract is acidified with nitric acid and then treated with silver nitrate. However if nitrogen and sulphur both are present, then Lassaigne's extract is boiled to expel nitrogen and sulphur which would otherwise interfere in the test for halogens.