Current carrying wire and charge invariance paradox I'm reading Purcell's Electricity and Magnetism book (5.9 "Interaction between a moving charge and other moving charges") where he explains how due to relativistic effects (length contraction) a magnetic force acting on a particle that moves near the wire in the lab frame (where the wire is stationary) is the result of an electric force that acts on the particle in its rest frame.
He starts with an uncharged wire (the charge densities of the electrons and the protons are equal in magnitude). Then he shows that in the frame of reference of the moving particle the linear densities of the electrons and protons are different and thus the wire looks charged. I have two questions:

*

*If the wire is neutral in the lab frame, how can it become charged in the moving frame? Isn't it a contradiction of the principle of charge invariance? I understand that the linear densities must change, but the total charge should not change.


*Let's examine a simpler setup. Suppose we have a neutral wire with protons and electrons both at rest in the lab frame (protons' and electrons' linear densities are $\lambda_0$ and $-\lambda_0$ respectively). Suppose we also have a charged particle at rest (also in the lab frame) near the wire. Suppose that all the electrons suddenly acquire some constant speed $v$ in the lab frame (for example, we turn on the electric field). So now we have stationary ions, moving electrons and a stationary charged particle (still, in the lab frame). Then we can use the same length contraction argument and claim that after acquiring the speed, the electron's density is now $-\gamma\lambda_0$. But then, using Purcell's argument we can claim that the total linear density of charge in the wire in the lab frame is $\lambda'=\lambda_0-\gamma\lambda_0=\lambda_0(1-\gamma)\neq 0$ therefore the wire becomes charged (again, using the same argument as Purcell). Therefore the stationary particle (we're still in the lab frame) will feel an electric force. However this seems to be wrong. What's wrong with this reasoning?
 A: This is a classic problem in relativity and you can find it treated in any book which discusses the application of relativity to electromagnetism.
To understand charge invariance, we don't need an integral over all space (but it is true that if one part of the wire acquired a charge density, then another part of the wire acquired an opposite net charge density). Invariance (with respect to change of frame) in this case means that each entity with a given charge (e.g. an electron, a proton) has that same charge no matter what reference frame you pick. As you say, the densities can change from one frame to another because distance measures can change.
If you put your charges in a box (I mean a real box made out of something such as copper) then the number of charges in the box stays fixed, as you change from one frame to another, but the size of the box does not.
However, in the case of a current-carrying neutral wire, you can't simply imagine that all the electrons and protons are fixed in the same given box, because the electrons are moving relative to the protons.
I think a good insight into the situation is obtained by drawing worldlines on a spacetime diagram. e.g. draw lots of vertical straight worldlines representing protons, then lots of sloping mutually parallel worldlines representing electrons. Make this second set have the same spacing as the proton ones in the frame where the latter are vertical. These lines represent the charges, and charge invariance is the fact that each line represents the same amount of charge no matter what frame you pick. Now take a look at the situation in the frame where the electrons are at rest. To do this, don't draw a new diagram. Just draw a line of simultaneity for the electrons: 

I have made part of the line of simultaneity bold in order to make it easy to see the result. There are 7 proton worldlines but only 5 electron worldlines intersecting the bold part. This means there is a net positive charge density on the wire, when the wire is observed in the rest frame of these electrons. It is because when changing frames from proton rest frame to electron rest frame, the protons here get closer together and the electrons get further apart. 
Elsewhere in the circuit the flow of current is in the reverse direction. I leave you to figure out what that implies. You can also, I hope, answer your own further questions by adopting this sort of spacetime approach.
A: Short answer:


*

*It can become charged in the moving frame; however, the principle of charge invariance is indeed not violated. Hint: what else is affected by the Lorentz boost?

*The flaws in your reasoning start here. Can you figure them out?

Suppose that all the electrons suddenly acquire some constant speed $v$ in the lab frame (for example, we turn on the electric field) [...] Then we can use the same length contraction argument and claim that after acquiring the speed, the electron's density is now $−γλ_0$.

Long answer:

1.) The current-carrying wire itself is length-contracted, and in fact length contraction is the reason why the charge density of the protons increases, so even though the new charge density for the protons is $\lambda_p' = \gamma\lambda_0$, the length of the wire measured in the moving frame is $L_p' = L_0/\gamma$, giving a total charge of $$q = \lambda_p' L_p' = \frac{\gamma\lambda_0L_0}{\gamma} = \lambda_0 L_0$$ The case with the electrons is similar, but instead they experience a "length dilation" of $L_e' = \gamma L_0$, since they were moving in the lab frame but are now at rest in the comoving frame. Their charge density is now $\lambda_e' = -\lambda_0/\gamma$.The other way to convince yourself that a net nonzero charge density must develop is to simply transform the electromagnetic fields into the new frame, which will ultimately yield the following: $$\mathbf E' = \gamma\mathbf v \times \mathbf B$$ $$\mathbf B' = \gamma\mathbf B$$ Since $\mathbf E'$ is a nonzero static field that diverges away from the wire, that must mean there is now a net nonzero charge density being observed.2.) There are three things fundamentally wrong in those two sentence.First is the implicit assumption that when the electric field is turned on, every part of the wire will experience its effects, despite the fact that one of the fundamental tenets of special relativity is that the effects of electromagnetism (and pretty much everything else) have a fundamental finite propagation speed.The second is the statement that the electrons will suddenly acquire infinite velocity, which would require an unphysical infinite acceleration.The third incorrect assumption is your naive application of the idea of length contraction, a phenomenon associated with a Lorentz boost between reference frames; the development of the current in the wire is not a mere mathematical transformation between reference frames, but rather a real, physical process involving accelerating charges, the effects of which must be considered when determining the worldlines of each electron.

A: 
If the wire is neutral in the lab frame, how can it become charged in the moving frame? Isn't it a contradiction of the principle of charge invariance?

Remember that the principle of charge invariance requires an integration over all of space. This means that the fact of charge invariance and the fact of the non-neutral wire in the moving frame can be combined to determine that the wire’s surroundings must have an equal and opposite charge. In the case of a narrow rectangular loop of wire it is easy to see that the return wire has an equal and opposite charge. 

Therefore the stationary particle (we're still in the lab frame) will feel an electric force. However this seems to be wrong. What's wrong with this reasoning?

Your reasoning is correct as far as you go, but you need to continue and finish the analysis. The charge has a non-zero velocity in the moving frame and there is a non-zero current density in the moving frame. Therefore, there is also a magnetic force on the charge. Taking the fact that there is an electric force in the moving frame and the fact that there is no force in the lab frame, you can easily see that the magnetic force in the moving frame must be equal and opposite to the electric force. Indeed, careful math can demonstrate that is the case, which is an exercise left for the reader. 
A: Remember that the protons are at rest so by contraction of electrons their distance with each other will increase too. This will lead to the same amount of charge density.
A: It is not becoming charged in the moving reference . Your source is wrong . 
Only if the carrier is conducting current , then it becomes electrically charged
