# Homework Help: Finding the magnetic field of an infinite cylindrical wire.

Tags:
1. Nov 28, 2014

### ghostfolk

1. The problem statement, all variables and given/known data
An infinite cylindrical wire of radius $R$ carries a current per unit area $\vec{J}$ which varies with the distance from the axis as $J(s)=ks^2\hat{z}$ for $0<s<R$ and zero otherwise where k is a constant.
Find the magnetic field $\vec{B(s)}$ in all space.
2. Relevant equations
$\oint B \cdot dl=\mu_0I_{enc}$
$\nabla \times B=\mu_0 \vec{J}$
3. The attempt at a solution

$\oint B \cdot dl=B2\pi s$, $I_{enc}= \Bigg\{ \begin{array}{lr} \frac{\pi ks^4\hat{z}}{2}, 0<s<R\\ \frac{\pi k R^4\hat{z}}{2},s \ge R \end{array}$
So,
$\vec{B}= \Bigg\{ \begin{array}{lr} \frac{ks^3\hat{z}]\mu_0}{4}, 0<s<R\\ \frac{kR^4\hat{z}\mu_0}{4s}, s \ge R \end{array}$.
However, when I calculate the curl of $\vec{B}$, I don't get back $\vec{J}$. Where am I wrong?

2. Nov 28, 2014

### vela

Staff Emeritus
For one thing, $\vec{B}$ doesn't point in the $\hat{z}$ direction.

3. Nov 28, 2014

### ghostfolk

4. Nov 28, 2014

### vela

Staff Emeritus
No. You must have seen figures depicting the magnetic field around a wire in your book, right? Use the right-hand rule to determine the direction.

5. Nov 28, 2014

### ghostfolk

Okay. So if I use $\vec{J} \times \vec{r}$ to find the direction of the magnetic field inside the wire, then the magnetic field should be in the $\hat{\phi}$ direction?

6. Nov 29, 2014

### vela

Staff Emeritus
Yup.