# Homework Help: Magnetic field from a wire at a point

1. Jun 20, 2017

### Decimal

1. The problem statement, all variables and given/known data

Picture of the problem:

I first need to calculate the magnetic field in point P caused by the piece of wire at z = R (so the top wire parallel to the y-axis).

2. Relevant equations

Biot-Savart law for magnetic fields:

$\vec {dB} = \frac {μ0*I} {4*π} * \frac {\vec {dl} ×\vec {r}} {r^3}$

3. The attempt at a solution

Here is what I did:

$\vec {dl} = dy * \vec {ey}$ (where ey is the unit vector in the y direction)
$\vec r = (P - y)* \vec {ey} - R * \vec {ez}$

then:

$\vec {dl} ×\vec r = -R*dy*\vec {ex}$

so now I can write:

$\vec {dB} = - \frac {μ0*I*R} {4*π} *\frac {1} {(P - y)^2 + R^2)^{3/2}} * dy * \vec {ex}$

Now I can integrate this using the substitution $u = P-y$ and $du = -dy$, and then integrate from $-L$ to $0$, which gives me an expression for the magnetic field:

$\vec B =\frac {μ0*I} {4*π*R} *(\frac {P} {\sqrt {P^2+R^2}} -\frac {P+L} {\sqrt {(P+L)^2+R^2}}) * \vec {ex}$

Now this answer is almost correct except there should be a minus in front. However my minus disappeared when I used the substitution $du = -dy$. Does anyone know where I went wrong?

Last edited: Jun 20, 2017
2. Jun 20, 2017

### kuruman

Check the details of the integration. You probably used a tangent substitution. How is the positive angle defined?

3. Jun 20, 2017

### Decimal

Integration:

$\vec B =- \frac {μ0*I*R} {4*π} * \int \frac {1} {(P - y)^2 + R^2)^{3/2}} * \vec {ex} \, dy$

$\vec B = - \frac {μ0*I*R} {4*π} * \int \frac {1} {(u)^2 + R^2)^{3/2}} * \vec {ex} \,* -du$

I am allowed to use the solution to some standard integrals, like this one, so I can just write out the solution directly:

$\vec B = - \frac {μ0*I*R} {4*π} * [\frac {-1} {R^2} * \frac {u} {\sqrt {u^2+R^2}}] \vec {ex}$

Then I substitute $u = P-y$ back in and evaluate the indefinite integral from $-L$ to $0$ which gets me to my final answer mentioned above:

$\vec B =\frac {μ0*I} {4*π*R} *(\frac {P} {\sqrt {P^2+R^2}} -\frac {P+L} {\sqrt {(P+L)^2+R^2}}) * \vec {ex}$

This is what I did, as you can see my minus sign cancelled out. I am not sure what you mean by the positive angle.

4. Jun 20, 2017

### kuruman

Why is the z-component of $\vec{r}$ negative?

5. Jun 20, 2017

### Decimal

$\vec r$ should point from the line segment $\vec {dl}$ to point $P$ right? So then it would have a negative z-component since it should point from $z=R$ to $z=0$

6. Jun 20, 2017

### kuruman

Yes, you're right. I think you put one minus sign too many with dy and the limits of integration. If you use the the right hand rule and the diagram below, you get
$\vec {dB} = - \frac {μ_0*I*R} {4*π} *\frac {1} {[(P + y)^2 + R^2]^{3/2}} * dy * \hat {x}$
Note the positive sign in the denominator. Also note that the limits of integration should be from zero to L, not negative L because the smallest value for the y-component of $\vec{r}$ is P and the largest value is P + L.

7. Jun 20, 2017

### Decimal

But shouldn't $r = \sqrt {(P-y)^2+P}$? Since y is always negative in this case so the y component of $\vec r = P-y$

8. Jun 20, 2017

### kuruman

I think your problem is with the back substitution from $u$ to $y$.
You have the indefinite integral (after cancellation of the two negative signs)
$\vec B = \frac {μ_0I} {4πR} \int \frac {du} {(u^2+R^2)^{3/2}} \hat {x} = \frac{u}{R^2\sqrt{R^2+u^2}}$
Since $u=P-y$, when $y=0$, $u = P$ and when $y=-L$, $u=P+L$. These are the lower and upper limits that you should put back in the indefinite integral for $u$.

Edited to clarify points and fix mistakes.

9. Jun 20, 2017

### Decimal

Yeah I think I have figured where I am going wrong, though I don't understand why yet. I did perform the back substitution of the limits as you mention in your post, however I am integrating from -L to 0, whilst you are integrating from 0 to -L. I thought you always have to integrate in the direction of the unit vector? Or am I misunderstanding this?

10. Jun 20, 2017

### kuruman

Not necessarily. It is element dy that is always assumed to be positive. The limits of integration add a negative sign or not.

11. Jun 20, 2017

### Decimal

mmm okay, so how do I know what to use as integration limits then? In this case dy points in the same direction as the current, so I figured I should just integrate in that direction too, since its also the direction of the unit vector. How would I know to integrate in the other direction in this case?

Thank you for your help by the way

12. Jun 20, 2017

### kuruman

Ignore the unit vector and its direction. The key things are the integrand, f(q) dq and the limits of integration. Note that I used q, a dummy variable of integration that eventually disappears when you evaluate the integral. You should always bear in mind that when you integrate, the "something" in d(something} can be any symbol. I think your confusion arises because you are treating y as both a dummy variable of integration and a Cartesian coordinate. In post #6 I have y increasing to the left. Strictly speaking, I should have called it something else, say q, because y should be reserved for the Cartesian coordinate that increases to the right.

Look at the drawing you made when you worked on this problem. Call the distance along the y-axis of element $d \vec{l}$ q, set up the definite integral and see where it takes you.

13. Jun 20, 2017

### TSny

Your answer looks correct to me. Note that your answer gives a negative number times the unit vector ex. This is the correct direction for B. I don't think there should be a minus sign in front.

14. Jun 21, 2017

### Decimal

Alright I found a similar exercise in with more elaborate explanations and they also don't arrive at a minus sign, so I think the answer is just wrong, like TSny said. Thanks a ton for your help though Kuruman since I have a much better understanding of how to perform the integration now, though even with your tips I would still arrive at my original answer.

Thanks!

15. Jun 21, 2017

### kuruman

Right you are. When I first looked at this, I concentrated on the denominator and ignored the $P+L$ in the numerator.