Let r be the shortest vector from a point on the wire to a point in space at which we wish to compute the magnetic field. Let r=∣r∣, and let r^ be the unit vector that points in the same direction as r. Let i^ denote a unit vector that points in the same direction as the current. Let x be the signed displacement along the wire from the point in space.
By the Biot-Savart Law,
dB=4πμ0⋅(x2+r2)3/2Idxi×(r−xi)
Now, to compute B, we integrate along the wire:
B=∫−∞∞4πμ0⋅(x2+r2)3/2Idxi×(r−xi)
Moving the constants out of the integral and simplifying slightly, we get:
B=2πμ0Ir(i^×r^)∫0∞(x2+r2)3/2dx
We can compute the integral on the right fairly easily using the substitution u=rtanθ. We get:
∫0∞(x2+r2)3/2dx=∫02πr3sec3θrsec2θdθ∫0∞(x2+r2)3/2dx=r21∫02πcosθdθ∫0∞(x2+r2)3/2dx=r21.
Finally, we plug this into our earlier expression for B to get:
B=2πrμ0I(i^×r^)
From the cross product, one can see that the magnetic field lines are circles that line in planes perpendicular to the wire and with center on the wire. Also, from the Right-Hand Rule for cross products, one can determine the direction of the magnetic field as follows:
Extend the thumb of your right hand in the direction of the current. Then, the fingers of your right hand will curl in the direction of the magnetic field.
Since i^×r^ is clearly a unit vector, the magnitude of the magnetic field is:
B=2πrμ0I.