Limits of Integration Trig, Mag Field Infinite Length Wire 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.
 A: With your definition of θ,  The Biot-Savart formula reduces to (km)I/R times the integral of sin(θ)(dθ) which integrates to the -cos(θ) and evaluates to (1+1) at the limits 0 to 180 degrees.
A: Over the length of the wire from -infinity to +infinity the angle theta varies from
 -pi/2 to +pi/2 and cos(theta) ranges from 0 through 1 and back to 0. It's never negative and the distance from any point on the wire to P is always positive. I think you create an unnecessary problem by treating the line from wire segment dl to P as a directional vector which it cannot be, for otherwise a point P at the center of a round current loop would experience no magnetic field. 
A: I think I figured out my confusion. With these limits defined, in order for cosine to be correct, I have to redefine cos=-adj/hyp. Then everything else works out fine. Weird. It feels wrong to just redefine cosine, but it's true under these defined limits. Is that right, is that something you have to do sometimes? Redefine a trig function? The rest of the math works out fine once I do that.
