Why does symmetry in the Ampère's law implies that the field is independent of that variable? For example: A steady current $I$ flows down a long cylindrical wire of radius a. We want to find the magnetic field inside and outside the wire. This problem has translational symmetry and thus the magnetic field doesn't depend on $z$ (cylindrical coordinates ($s,\varphi,z$)).
My question is why translational symmetry implies the magnetic field doesn't depend on $z$. I can't understand why and I need a clear explanation. I have seen the same reasoning in other electromagnetism problems and I can't understand why exactly this is true. For example in solving Laplace equation.
 A: The idea behind this argument is far more general than just the situation you've presented, though this is often the first kind of example students in physics will encounter. So let me try and give you an idea about how this works in general since that might also give you a peek into why symmetry can be so powerful.
Let $f(x,y)$ be any function of $x$ and $y$. If $f$ has a "translational" symmetry in $x$, that means we can shift $x$ by any amount $a$ and still get the same result from $f$. That is, $f(x+a,y)=f(x,y)$. But since $a$ can take any real value by assumption, and if we also assume $f$ is differentiable, it follows we can take an $a$ derivative of both sides here. The RHS clearly does not depend on $a$, so we find
$$
\frac{\partial}{\partial a}f(x+a,y)=0.
$$
Importantly, this relation holds for all $x,y,$ and $a$. There's a couple different ways to put it into words, but the above fact necessarily implies
$$
\frac{\partial }{\partial x}f(x,y)=0
$$
for all $x$ and $y$, and hence $f$ cannot actually depend on $x$. One way of putting arguing that this follows from the $a$ derivative is to use the chain rule to write $\frac{\partial}{\partial a}=\frac{\partial}{\partial (x+a)}$ and subsequently take the special case $a=0$ (or rename the variable $x+a$ to $x$).
This is what a continuous symmetry can buy us. For a more complicated example of how this works, suppose the function $f(\boldsymbol{x})$ is still a function of $x$ and $y$, but now I've just collected the $x$ and $y$ into the vector coordinate $\boldsymbol{x}$.
If this $f$ is invariant under rotations, we can also investigate what happens, and in two different ways. The most straightforward way would be to rewrite $f$ in terms of the polar coordinates as $f(r,\theta)$ so invariance under rotations would mean $f(r,\theta+a)=f(r,\theta)$ and we can pull the same trick as above to show that $f$ cannot actually depend upon $\theta$.
It's also instructive, however, to see how this would play out in cartesian coordinates. In that case, we would rotate the coordinates by applying some rotation matrix $R(a)$ to $\boldsymbol{x}$. For example,
$$
R(a)=\left(\begin{array}{cc}
\cos a & -\sin a\\
\sin a & \cos a
\end{array}\right)
$$
would do the trick.
Then the statement of rotation invariance would be written as $f(R(a)\boldsymbol{x}) = f(\boldsymbol{x})$. Taking an $a$ derivative of this, and applying the chain rule, we would find
$$
\sum_{ij}\frac{\partial R_i^j x^i}{\partial a}\frac{\partial f}{\partial x^j}\Bigg|_{R\boldsymbol x}=0.
$$
The notation here is always a little messy, but we can always write this out explicitly (or have written $f(R(a)\boldsymbol{x})$ out in terms of $x$ and $y$ before taking the $a$ derivative) to find
$$
x\frac{\partial f}{\partial y}-y\frac{\partial f}{\partial x}=0
$$
after setting $a=0$. If you like, you can show by chain rule that $\frac{\partial}{\partial \theta}=x\frac{\partial }{\partial y}-y\frac{\partial }{\partial x}$ when converting between polar and Cartesian coordinates.
So what does all this mean? Asserting that a function obeys a particular (continuous) symmetry always implies that the function obeys a certain differential equation which can be found with the same approach as I have used here. In the special coordinates in which said symmetry is a "translation," this differential equation will just tell us that the function doesn't depend on that particular variable. As a result, it's often very useful to work in coordinates which are "adapted" in this way to the symmetries of the problem, but in no sense are we bound to such a choice by necessity. As we have seen, if we choose a different coordinate system the differential equation implied by the symmetry is just a bit more complicated.
