Fundamental theorem of calculus - Wikipedia, the free encyclopedia
Just in case a picture helps...
... differentiating downwards with respect to x (on the left) or with respect to the dashed balloon (right), the latter referring to chain rule, as below.
You might like to use properties of definite integrals to split the integral around a constant a.
For the half from a up to cos x...
... where (key in spoiler) ...
So you have half of the derivative you seek, on the bottom row, and you'll want to subtract a similar result got from applying the same process but with sin in the dashed balloon.
Don't integrate - balloontegrate!
Balloon Calculus; standard integrals, derivatives and methods
Balloon Calculus Drawing with LaTeX and Asymptote!