My book seems to do something like this here. My only question is that if we integrate with respect to theta...will it still work?

The reason I chose to do it this way is precisely because it is so obviously clear that this is $\displaystyle 2 cos \theta$. But otherwise, it doesn't make a lot of sense to me this way.

Thanks for your help, in advance.