# How to simplify expression after diff so that the denominator remains unchanged relative to the initial expression. [closed]

Dear experts, I have next initial expression: $$y=\dfrac{2x-3}{5-2x}$$ and I need find y'. In this case I use rule $$\left( \dfrac{u}{v} \right)' = \dfrac{u'v-uv'}{v^2}$$ and expect to obtain next result after simplification: $$y' = \dfrac{4}{(5-2x)^2}$$ But after diff((2x-3)/(5-2x),x) and simplification with factor() I get. $$y' = \dfrac{4}{(2x-5)^2}$$ How I can get $$(5-2x)^2$$ in denominator of derivative?

edit retag reopen merge delete

### Closed for the following reason the question is answered, right answer was accepted by y023rus close date 2023-10-24 20:21:12.590365

Sort by ยป oldest newest most voted

You can use .denominator() to extract the denominator:

diff((2*x-3)/(5-2*x),x).factor().denominator()


or

diff((2*x-3)/(5-2*x),x).denominator().factor()

more

your code gives $(2x - 5)^2$ not $(5-2x)^2$ as I need

( 2023-10-24 14:16:02 +0200 )edit

Mathematically speaking, it's the same expression. It's just a matter of how Sage orders terms in the representation. There is not much you can do about that, see https://ask.sagemath.org/question/73507/ for details and further references.

( 2023-10-24 17:57:39 +0200 )edit