Reducing the number of variables of a polynomial