I don't understand how the limits of integration should be defined when doing basic integrals of trig functions. It seems like it's an arbitrary decision, I don't understand it.
Here's the set up: For the field near a long straight wire carrying a current $I$, show the Biot-Savart law gives the same result as Ampere's law.
Now intuitively, for me at least, with the way that $\theta$ is defined, I would view the angle as becoming smaller as $y$ moves toward negative infinity. So the limits of integration make sense in that regards. But then the cosine doesn't make sense anymore. As $y$ becomes more negative, which corresponds to an angle between $0$ and $\pi/2$, then cosine should always be positive. But because cos=adj/hyp, then $\cos\theta=y/r$, and $y$ would be negative, even though the corresponding angle is between $0$ and $\pi/2$?
I know I'm misunderstanding something fundamental, hopefully somebody can help me so I can move on. I've been struggling with this for so long because it's easy enough to arbitrarily assign limits to get the answer you're looking for, but I want to know the right way, and more importantly, why it's the right way.