We wish to evaluate the indefinite integral
∫cos(lnx)dx.
Because the argument of the cosine is lnx, it is natural to remove the logarithm by the substitution
t=lnx.
Then we have x=et and, differentiating both sides,
dx=dtdxdt=etdt=xdt.
Substituting these expressions into the integral gives
∫cos(lnx)dx=∫cos(t)(etdt)=∫etcostdt.
Now we have to integrate the product etcost. For such integrals the standard method is integration by parts applied twice, but an even quicker way is to recall the known formula
∫eatcos(bt)dt=a2+b2eat(acosbt+bsinbt)+C.
In our case a=1 and b=1, so
∫etcostdt=12+12et(1⋅cost+1⋅sint)+C=2et(cost+sint)+C.
Now we back-substitute t=lnx and et=x:
∫cos(lnx)dx=2x(cos(lnx)+sin(lnx))+C.
Hence, the correct answer is Option D.