Answer
Given
y=xxcosx+x2−1x2+1
the two terms are differentiated separately. Write u=xxcosx and v=x2−1x2+1, so dxdy=dxdu+dxdv.
Step 1: the first term, by logarithmic differentiation
Both the base and the exponent contain x, so take logarithms:
logu=xcosxlogx
The right-hand side is a product of xcosx and logx. Differentiating, with the product rule used twice:
u1dxdu=(cosx−xsinx)logx+xcosx⋅x1
and the last term simplifies to cosx, so
dxdu=xxcosx[(cosx−xsinx)logx+cosx]
Step 2: the second term, by the quotient rule
dxdv=(x2−1)2(x2−1)(2x)−(x2+1)(2x)=(x2−1)22x[(x2−1)−(x2+1)]
The bracket is −2, so
dxdv=(x2−1)2−4x
Step 3: the answer
dxdy=xxcosx[(cosx−xsinx)logx+cosx]−(x2−1)24x
A caution on the exponent. The exponent here is the whole product xcosx, not x alone — xxcosx is not xxcosx. Reading it the second way turns the first term into an ordinary product and loses the −xsinx entirely.