I have a long expression, only representative terms are given below. As a first step, I want to collect terms in terms of u[x,t] and its derivatives. The second step is to make those coefficients equal to zero as separate equations. For example, if I have the expression: xpr=a[x, t, u]*Derivative[1, 0][u][x, t] + 2*Derivative[0, 1][u][x, t]* Derivative[1, 0][u][x, t]*Derivative[0, 0, 1][b][x, t, u] + 2*u[x, t]*Derivative[1, 0][u][x, t]^2*Derivative[0, 0, 1][b][x, t, u] + 2*Derivative[1, 0][u][x, t]*Derivative[1, 1][u][x, t]*Derivative[0, 0, 1][c][x, t, u]+2*Derivative[0, 1][u][x, t]* Derivative[1, 0][u][x, t]*Derivative[0, 0, 1][d][x, t, u]; The first step should result in: stp1=a[x, t, u]*Derivative[1, 0][u][x, t] + 2*u[x, t]*Derivative[1, 0][u][x, t]^2* Derivative[0, 0, 1][b][x, t, u] + 2*Derivative[1, 0][u][x, t]* Derivative[1, 1][u][x, t]*Derivative[0, 0, 1][c][x, t, u] + Derivative[0, 1][u][x, t]*Derivative[1, 0][u][x, t]* (2*Derivative[0, 0, 1][b][x, t, u] + 2*Derivative[0, 0, 1][d][x, t, u]) The last step will give rise to: eqns={a[x, t, u] == 0, 2*Derivative[0, 0, 1][b][x, t, u] == 0, 2*Derivative[0, 0, 1][c][x, t, u] == 0, 2*Derivative[0, 0, 1][b][x, t, u] + 2*Derivative[0, 0, 1][d][x, t, u] == 0}, Your help is much appreciated.