# Determining magnetic intensity of tube with variable current density

I'm having the following problem:

Given tube with outer radius of $R_2$ and inner radius of $R_1$ there is electrical current, with density given by $j(r) = j_0 r$. Using Amperes law determine intensity of magnetic field in each point in space.

So, using Amperes law I get that $\oint \vec{B}d\vec{l} = \mu_o I$ and $B = \frac{\mu_o I}{2\pi r}$.

Now, when solving problems like these I have to describe 3 cases:

1. When $r < R_1$, intensity is obviously zero, because $I = 0$.
2. When $r \geq R_2$, intensity is equal to $\frac{\mu_o I}{2\pi r}$, where $I$ is total current in tube.
3. When $r \in (R_1, R_2)$, then I have to find current dependent on radius, i.e. $I(r)$. With constant current density, It would be $I(r) = jS(r) = \frac{I(r^2 - R_1^2)}{R_2^2 - R_1^2}$.

Now, the first case is simple, second one requires just integration of current density throughout whole tube ($I = j_o\int_{0}^{2\pi}d\varphi \int_{R_1}^{R_2} r^2 dr = 2\pi j_0 \frac{R_2^3 - R_1^3}{3}).$ What about third one? My attempt/guess is to create function $I(r) = j(r)S(r) = j_0r\pi(R_2^2 - R_1^2)$, but what next? Can I write $j_0 = \frac{I}{S}$, where I is total current obtained above?

I don't think so - the question tells you quite explicitly that the current density will be a function of radius, $j(r) = j_0 r$ (and not uniform). The integral of current density over the entire surface will be $I$. Therefore you know that the current in an annulus $dr$ at a distance $r$ is
$$I(r) = 2\pi ~r ~j(r) ~dr = 2\pi r^2 j_0 dr$$
Integrate that, and set it equal to the total current. Now you have an expression for $j_0$ and you can solve.