Abstract.We consider the problem of deciding if a set of quantum onequdit gates S = {g1, . . . , gn} ⊂ G is universal, i.e. if is dense in G, where G is either the special unitary or the special orthogonal group. To every gate g in S we assign the orthogonal matrix Adg that is image of g under the adjoint representation Ad : G → SO(g) and g is the Lie algebra of G. The necessary condition for the universality of S is that the only matrices that commute with all Adg i 's are proportional to the identity. If in addition there is an element in whose Hilbert-Schmidt distance from the centre of G belongs to ]0, 1 √ 2 [, then S is universal. Using these we provide a simple algorithm that allows deciding the universality of any set of d-dimensional gates in a finite number of steps and formulate a general classification theorem.