Magnetic field in a cavity We are given an infinitely long cylinder of radius $b$ with an empty cylinder (not coaxial) cut out of it, of radius $a$. The system carries a steady current (direction along the cylinders) of size $I$. I am trying to find the magnetic field at a point in the hollow. I am told that the answer is that the magnetic field is uniform throughout the  cavity. and is proportional to  $d\over b^2-a^2$ where $d$ is the distance between the centers of the cylinders.
Attempt:
I have found by using Ampere's law that the magnetic field at a point at distance r from the axis in a cylinder of radius $R$ carrying a steady current, $I$, is given by $\mu_0 I r\over 2\pi R^2$. So I thought I would use superposition. But what I get is ${\mu_0 I \sqrt{(x-d)^2+y^2}\over 2\pi b^2}-{\mu_0 I \sqrt{(x)^2+y^2}\over 2\pi a^2}$. However this is not the given answer!
 A: This is a problem of superposition--- you can imagine this is a uniform cylinder carrying a current, and the cut-out part is another uniform cylinder carrying a current of the same current density in the opposite direction. Then you superpose the two fields of the two cylinders, and you get the total field.
Ampere's law tells you that the magnetic field inside a cylinder is linearly proportional to the distance from the center, and goes around the center line as given by the right hand rule. So that for a uniform cylinder with current density j going in the z-direction,
$$ B_x \propto - j(y-y_0) $$
$$ B_y \propto + j(x-x_0) $$
for the opposite current density cylinder, you just reverse the sign of j. When you add, the x and y dependent parts cancel out, so that the field is constant.
A: Hint: Take the position vector of center of hole as $\vec{a}$, and take the relative p.v. of a point in the cavity as $\vec{r_1}$. Solve vectorially, you'll be surprised by the result.
A similar surprise occurs when you have the same cylinder with a uniform charge density. Maybe you should try this first, magnetic fields involve the extra cross product (It gets out of the way here, though)
Yes, superposition is useful here.
