We use logarithmic differentiation separately on each term because the variable appears in both the base and the exponent. The derivative is
(xcosx)x[log(xcosx)+x⋅xcosxcosx−xsinx]+(xsinx)1/x[−x21log(xsinx)+x1⋅xsinxsinx+xcosx].
When a function has the variable in both the base and the exponent — like u(x)v(x) — the standard power rule or exponential rule alone won't work. The trick is to take natural logs first, which brings the exponent down as a multiplier, then differentiate implicitly. That's the heart of logarithmic differentiation.
Here we have a sum of two such terms:
y=(xcosx)x+(xsinx)1/x.
Let’s call them y1 and y2:
y1=(xcosx)x,y2=(xsinx)1/x.
Then y′=y1′+y2′. We'll handle each separately.
1. Differentiate y1=(xcosx)x
Take natural log of both sides:
logy1=log((xcosx)x)=xlog(xcosx).
Now differentiate both sides with respect to x. On the left, by the chain rule:
y11⋅y1′=dxd[xlog(xcosx)].
On the right, use the product rule:
dxd[xlog(xcosx)]=1⋅log(xcosx)+x⋅dxd[log(xcosx)].
Now differentiate log(xcosx). Let u=xcosx. Then
dxdlogu=u1⋅u′=xcosx1⋅dxd(xcosx).
Differentiate xcosx using the product rule:
dxd(xcosx)=1⋅cosx+x⋅(−sinx)=cosx−xsinx.
So
dxdlog(xcosx)=xcosxcosx−xsinx.
Putting it back:
dxd[xlog(xcosx)]=log(xcosx)+x⋅xcosxcosx−xsinx.
Thus
y11y1′=log(xcosx)+cosxcosx−xsinx.
Multiply through by y1:
y1′=(xcosx)x[log(xcosx)+cosxcosx−xsinx].
Notice that cosxcosx−xsinx=1−xtanx, but leaving it as a fraction is often cleaner for exam marking.
2. Differentiate y2=(xsinx)1/x
Again, take logs:
logy2=x1log(xsinx).
Differentiate:
y21y2′=dxd[x1log(xsinx)].
Use the product rule (or quotient rule — here it's a product of x−1 and log(xsinx)):
dxd[x−1log(xsinx)]=−x21log(xsinx)+x1⋅dxd[log(xsinx)].
Now differentiate log(xsinx). Let v=xsinx. Then
dxdlogv=v1⋅v′=xsinx1⋅dxd(xsinx).
Differentiate xsinx:
dxd(xsinx)=1⋅sinx+x⋅cosx=sinx+xcosx.
So …