Change in line density of electrons We're proving that electricity and magnetism are essentially two manifestations of the same underlying phenomenon by using the toy example of a positive charge moving parallel to an infinitely long current carrying wire.
I'm having trouble understanding why the line density of the positive ions and electrons in the wire changes between the laboratory frames and the rest frame of the test charge to yield a net electric field in the rest frame.
In the laboratory frame (O), the positive ions have line density $\lambda_0 $ and velocity $\mathbf{v} = 0$ and the electrons have a line density $-\lambda_0 $ and velocity $\mathbf{v} = -v_o$, so the net current is $I = \lambda_0v_0$, and the net charge on the wire is $Q = 0$. I think the simplest case would be if the test charge has velocity $\mathbf{v} = -v_o$. So it is clear that the test charge experiences a force due to the magnetic field produced by the current in the Lab frame.
My problem comes about when we move to the test charge's rest frame. The lecture notes say that length contraction increases the line density of the positive ions to $\lambda_+ = \gamma \lambda_0 $ and decreases the line density of the electrons to $\lambda_- = \frac{\lambda_0}{\gamma} $ to yield a net positive charge and an electric field around the wire. But I can't see how this comes about - I thought charge was a relativistic invariant? How did we 'create' charge by moving from one reference frame to another? I can't see why length contraction affects the line density of the charge carriers and why the positive ions' line density increase and the electrons' decrease.
 A: Yes, charge doesn't change in a Lorentz transformation.  That's precisely why charge density must change in a Lorentz transformation.  If in the lab frame, a length $L$  of a wire has a (stationary) charge density of $\lambda$ on it, the total charge on the wire is $Q=\lambda L$.  In a frame of reference in which due to length contraction the wire is measured as only having a length $L'=L/\gamma$, the charge density in that frame of reference must be $\lambda'=\gamma \lambda$, so that the charge on the wire as measured in that frame, $Q=\lambda' L'$, is the same as in the lab frame.
In an arbitrary inertial frame of reference, a charge density as measured in that frame will be a Lorentz factor greater than the charge density as measured in the frame in which that charge density is at rest, due to length contraction.  In general, charge densities don't transform so simply between frames, because the spatial charge density and the temporal charge density (i.e. current) intermix in a transformation. But in the frame in which the (spatial) charge density is at rest, the temporal charge density is zero, so there isn't an extra term in the transformation in that case to account for a temporal charge density in one frame contributing to the spatial charge density in the other frame.
Applying that rule to this case, the positive ions are at rest in the lab frame, so $\lambda_+ = \gamma \lambda_0$.  But the electrons are at rest in the test particle's frame, so the rule says that $\lambda_0 = \gamma \lambda_-$, or $\lambda_- = \lambda_0/\gamma$.
