An inversion formula for two polynomials in two variables