I was looking at questions on differentiation and came across a weird form that both me and my friend had two different approaches to. This was the question.
Calculate the derivative:
$$ \frac{d(x-\sin(x))}{d(1-\cos(x))} $$
My approach was to factorize out an $x$ in the denominator of the fraction and differentiate as normal like so:
$$ \frac{d(x-\sin(x))}{dx(\frac{1}{x} - \frac{\cos(x)}{x})} = \frac{d}{dx}(\frac{x-\sin(x)}{\frac{1}{x} - \frac{\cos(x)}{x}}) $$
My friend's approach was to let $ u = 1-\cos(x) $ and to then take the approach that way leading to an answer.
Which way would be considered correct and why would this work? Thank you!
Hint:
$$\frac{dy}{dz} = \frac{dy}{dx} \frac{dx}{dz} = \frac{\frac{dy}{dx}}{\frac{dz}{dx}}$$
Let $y = x-\sin(x)$ and $z=1-\cos(x)$