Step 1: State Ampere's circuital law.
It states that the line integral of the magnetic field \( \vec{B} \) taken around any closed loop (Amperian loop) is equal to \( \mu_0 \) times the total (net) current \( I_{enc} \) threading through that loop.
\[ \oint \vec{B}\cdot d\vec{l} = \mu_0\, I_{enc} \]
Here \( \mu_0 = 4\pi\times10^{-7}\ \text{T m A}^{-1} \) is the permeability of free space.
Step 2: Describe the solenoid.
A solenoid is a long cylindrical coil of closely wound turns. Let it have \( n \) turns per unit length carrying current \( I \). For a long (ideal) solenoid the field inside is uniform and directed along the axis, while the field outside is nearly zero.
Step 3: Choose an Amperian loop.
Take a rectangular loop \( abcd \) with the side \( ab \) of length \( L \) lying inside the solenoid parallel to the axis, the side \( cd \) of the same length lying outside, and the two short sides \( bc \) and \( da \) perpendicular to the axis.
Step 4: Evaluate the line integral over each side.
Side \( ab \) (inside, along \( B \)): contribution \( = B\,L \).
Sides \( bc \) and \( da \): here \( \vec{B}\perp d\vec{l} \) inside and \( B=0 \) outside, so contribution \( = 0 \).
Side \( cd \) (outside): \( B\approx 0 \), so contribution \( = 0 \).
Therefore \( \oint \vec{B}\cdot d\vec{l} = B\,L \).
Step 5: Find the enclosed current.
Number of turns enclosed by the loop \( = nL \). Each carries current \( I \), so \( I_{enc} = nLI \).
Step 6: Apply Ampere's law and solve.
\[ B\,L = \mu_0 (nLI) \]
\[ B = \mu_0 n I \]
This is the required uniform magnetic field inside a long current carrying solenoid.
\[\boxed{B = \mu_0 n I}\]