# How to substitute a function in a derivative

I know that if $U(x, y) = A x^\alpha y^\beta$, I have $U_x = \alpha A x^{\alpha-1} y ^\beta$. But by substitution, I can obtain $U_x = \alpha \left(\frac{U}{x}\right)$. Is there a way to obtain this in Sagemath. I have tried

U_x= U.diff(x).subs(A*x^(alpha)*y^(beta)== U)

but this has no effect.