Here’s how you do it
Prepare the reagent
Prepare the reagent by adding ##NaOH## solution dropwise to a solution of ##AgNO_3## until a precipitate just forms; then add dropwise just enough dilute aqueous ##NH_3## to dissolve the precipitate.
Do the test
To carry out the test add a few drops of the unknown to the freshly prepared reagent in a clean test tube and warm gently for a few minutes in a hot water bath.
The formation of a grey-black precipitate or a silver mirror on the inside of the test tube is a positive result.
Why it works
The Tollens reagent is a colourless solution of ##Ag(NH_3)_2^+## that is prepared in a two-step procedure.
1. ##NaOH(aq)## is added to ##AgNO_3(aq)##.
##2AgNO_3 + 2NaOH Ag_2O + 2NaNO_3 + H_2O##
2. Aqueous ##NH_3## is added dropwise until the precipitated silver oxide dissolves completely.
##Ag_2O+ 4NH_3 + H_2O 2Ag(NH_3)_2^+ + 2OH^-##
3. The ##Ag(NH_3)_2^+## oxidizes aldehydes to the corresponding carboxylic acids which are converted to carboxylate ions in the basic medium.
##RCHOcolor(white)(l) + 2Ag(NH_3)_2^+ + 3OH^- RCOO^- + 2Ag(s) + 2NH_3 + 2H_2O##
If you are lucky a silver mirror forms on the inside of the test tube; if you are unlucky you get a grey-black precipitate of silver.
The Tollens reagent does not oxidize ketones so the Tollens test distinguishes aldehydes from ketones.