Consider a current density:
$$\vec{j}=j_0(1-\frac{r^2}{R^2})\vec{e_3}$$ if $r\le R$ and $j=0$ if $r\ge R$
where $r$ is the distance from the $x_3$ axis.
I need to use Biot-Savart law to find the direction of the magnetic field:
$$B(r)=\frac{\mu_0}{4\pi}\int \frac{J(r') \times {\widehat{n}}}{\eta ^2}$$
So i only need to calculate $$J(r') \times \widehat{n}$$
So this is making me stuck. Since $j$ is only in $e_3$ head, the cross product can be both in $e_1$ and $e_2$ head right? How exactly can i calculate this?
EDIT:
If i use ampere's law:
$$\int B \cdot dl = \mu_0 I_{enc}=\mu_0j_0\int(1-\frac{r^2}{R^2}\vec{e_3})da$$
I ran into the same problem as before, what do i do witth the directitonal vector $\vec{e_3}$
Note that for $r'<R$, we have $\vec J(\vec r')\times (\vec r-\vec r')=J_0\left(1-\frac{r'^2}{R^2}\right)\hat (\hat \phi r-\hat \phi'r')$. Therefore, we have
$$\begin{align} \vec B(\vec r)&=\frac{\mu_0}{4\pi}\int_{-\infty}^\infty\int_0^R\int_0^{2\pi} \frac{\vec J(\vec r')\times (\vec r-\vec r')}{|\vec r-\vec r'|^3}\,r'\,dr'\,d\phi'\,dz'\\\\ &=\frac{\mu_0J_0}{4\pi}\int_{-\infty}^\infty\int_0^R\int_0^{2\pi} \frac{\left(1-\frac{r'^2}{R^2}\right)\hat (\hat \phi r-\hat \phi'r')}{(r^2+r'^2-2rr'\cos(\phi-\phi')+(z-z'))^{3/2}}\,r'\,dr'\,d\phi'\,dz'\\\\ &=\frac{\mu_0J_0}{2\pi}\int_0^R\int_0^{2\pi} \frac{\left(1-\frac{r'^2}{R^2}\right)\hat (\hat \phi r-\hat \phi'r')}{r^2+r'^2-2rr'\cos(\phi-\phi')}\,r'\,dr'\,d\phi'\\\\ &=\frac{\mu_0J_0}{2\pi}\int_0^R\int_0^{2\pi} \frac{\left(1-\frac{r'^2}{R^2}\right)\hat (\hat \phi (r-r'\cos(\phi-\phi'))-\hat rr'\sin(\phi-\phi'))}{r^2+r'^2-2rr'\cos(\phi-\phi')}\,r'\,dr'\,d\phi'\\\\ &=\hat \phi\frac{\mu_0J_0}{2\pi}\int_0^R\int_0^{2\pi} \frac{\left(1-\frac{r'^2}{R^2}\right) (r-r'\cos(\phi'))}{r^2+r'^2-2rr'\cos(\phi')}\,r'\,dr'\,d\phi'\\\\ &=\hat \phi\frac{\mu_0J_0}{r}\int_0^{\min(r,R)} \left(1-\frac{r'^2}{R^2}\right) \,r'\,dr'\,d\phi'\\\\ &=\hat \phi\frac{\mu_0J_0}{r}\left(\frac{\min(r^2,R^2)}{2}-\frac{\min(r^4,R^4)}{4R^2}\right) \end{align}$$