Well, it is outside the syllabus, but you could use complex numbers. Then you don't have to use integration by parts at all.
cos(x)= 1/2(e^(ix) + e^(-ix))
You just treat i like an ordinary constant, and it all works out in the end. (You will eventually get a real valued function out of doing...