We give a simple derivation of the Virasoro constraints in the Kontsevich model, first derived by Witten. We generalize the method to a model of unitary matrices, for which we find a new set of Virasoro constraints. Finally we discuss the solution for symmetric matrices in an external field.