Derivation (magnetic field due to solenoid)
Outside a long solenoid:
-
Consider the green surface. Since $\nabla\cdot\v B = 0$, radial field = 0.
-
Consider the green loop with the further side pulled to infinity. Using Ampere's law, we have longitudinal field = 0.
-
Consider the black loop. Using Ampere's law, we have azimuthal field = 0.
Inside a long solenoid: $$ \begin{align*} B = \mu_0 I \frac{N}{l} \end{align*} $$ where $N/l$ is the number of windings per unit length.