Let's define a simple equation $\Omega(x,y)$ x1 = m3*Sqrt[3]; y1 = 0; x2 = Sqrt[3]/2*(2*m3 - 1); y2 = 1/2; x3 = x2; y3 = -y2; r1 = Sqrt[(x - x1)^2 + (y - y1)^2]; r2 = Sqrt[(x - x2)^2 + (y - y2)^2]; r3 = Sqrt[(x - x3)^2 + (y - y3)^2]; Ω = (1 - 2*m3)/r1 + m3/r2 + m3/r3 + 1/2*(x^2 + y^2); Then some rules rule1 = {m3*Sqrt[3] -> x10, 1/2*Sqrt[3]*(2*m3 - 1) -> x20}; rule2 = {((x - x10)^2 + y^2) -> r10, ((x - x20)^2 + (y - 1/2)^2) -> r20, ((x - x20)^2 + (y + 1/2)^2) -> r30}; When I compute the first derivative with respect to $x$ Ωx = D[Ω, x]; and I use the rules as Simplify[Ωx /. rule1 /. rule2] I get the following output [![enter image description here][1]][1] As you can see, the rules work well in the second term, while on the other hand they fail in the third and fourth term. Why? Any suggestions on how to simplify the output according to the above-mentioned rules? [1]: https://i.sstatic.net/lAyeW.png