Solving Virasoro constraints in matrix models