Answer:
Please refer to the figure.
Explanation:
The crucial point here is to calculate the enclosed current. If the current I is flowing through the whole cross-sectional area of the wire, the current density is
[tex]J = \frac{I}{\pi R^2}[/tex]
The current density is constant for different parts of the wire. This idea is similar to that of the density of a glass of water is equal to the density of a whole bucket of water.
So,
[tex]J = \frac{I}{\pi R^2} = \frac{I_{enc}}{\pi r^2}\\I_{enc} = \frac{Ir^2}{R^2}[/tex]
This enclosed current is now to be used in Ampere’s Law.
[tex]\mu_o I_{enc} = \int {B} \, dl[/tex]
Here, [tex]\int \, dl[/tex] represents the circular path of radius r. So we can replace the integral with the circumference of the path, [tex]2\pi r[/tex].
As a result, the magnetic field is
[tex]B = \frac{\mu_0}{2\pi}\frac{Ir}{R^2}[/tex]