Magnetic field of a bent wire

1. Nov 11, 2015

whatisreality

1. The problem statement, all variables and given/known data
A straight wire carrying current I goes down the positive y-axis ( I is also in this direction) from infinite y to the origin. At the origin it changes direction 90 degrees and goes along positive x to infinity. Find B at (0,0,z).
I'm given that
$\int_{0}^{\infty} \frac{dx}{(x^2+y^2)^{\frac{3}{2}}} = \frac{1}{z^2}$

2. Relevant equations
dB = $\frac{\mu_0 I}{4 \pi} \frac{dl sin(\theta)}{r^2}$
This has been simplified from the Biot Savart law by subbing in unit vector r = r/r, and taking the magnitude of the cross product. $\theta$ is the angle between dl and r.
3. The attempt at a solution

I'm having trouble working out the direction. I split the wire into two segments, calculating B for the segment on the y axis first, then for the segment on the x axis, then adding them.
For segment along y axis:
dl is -dy (or is it just dy?), sin($\theta$) = $\frac{z}{\sqrt{y^2+z^2}}$ and r = $\sqrt{y^2+z^2}$:
dB = $- \frac{\mu_0 I}{4 \pi} \frac{z dy}{(y^2+z^2)^{\frac{3}{2}}}$
= $- \frac{\mu_0 I z}{4 \pi} \frac{dy}{(y^2+z^2)^{\frac{3}{2}}}$
Integrate dB between 0 and infinity using the given result for the integral:

B = $- \frac{\mu_0 I }{4 \pi} \frac{1}{z}$
Happy with the magnitude, half that of an infinite wire as expected.

Ignoring the other segment for now, what do I do about the direction?? From the right hand rule, it's in the -x direction, but if I multiply by the negative unit vector in x then the negatives cancel, and it's actually in the positive x direction, which is wrong! Isn't it?

Last edited: Nov 11, 2015
2. Nov 11, 2015

Chandra Prayaga

You are right about the field direction being in the - x direction. Your mistake is in taking the negative sign at the end of your integration seriously. When you write the magnitude of a cross product;

C = AB sinθ, that is the magnitude. It is always positive. The direction of the vector is completely determined by the right hand rule.

What you should say is:
Even though the integral gave you a negative sign, we want only the magnitude of B from that integration. The direction is determined to be - x from the right hand rule

3. Nov 11, 2015

whatisreality

Brilliant, thanks!