Looking at #int cos(lnx) dx#, we realize that if can't integrate straight away. Next thought is, perhaps we could use substitution.
We would need #cos(lnx) 1/x# to integrate by substitution.
Running out of ideas, let's try putting in the "missing" #1/x# and an #x# to make up for it and try integrating by parts. (Yes, really. Try something first and see if it works.)
#int cos(lnx) dx = int xcos(lnx) * 1/x dx #
Let #u = x# #" "# and #" "# #dv = cos(lnx) 1/x dx#
So, #du = dx# #" "# and #" "# #v = sin(lnx)#
#int cos(lnx) dx = xsin(lnx) - underbrace(int sin(lnx) dx)_("again insert "x*1/x)# #" "#( note below)
#int cos(lnx) dx = xsin(lnx) - int xsin(lnx) 1/x dx#
# = xsin(lnx) - [-xcos(lnx) -int -cos(lnx) dx]#
So we now have:
#int cos(lnx) dx = xsin(lnx) + xcos(lnx) - int cos(lnx) dx#
#I = xsin(lnx) + xcos(lnx) - I#
gets us:
#I = 1/2 [xsin(lnx) + xcos(lnx)]#
#int cos(lnx) dx = 1/2 [xsin(lnx) + xcos(lnx)] +C#
As always, check by differentiating.
note it is clear that we have a different integral at this point, but it is not clear that we have made progress until we try another step or two. If it had not worked, we would need to go back to the beginning and try something else.