A solenoid is a long wire wound closely in the form of a helix (spring). The gap between two consecutive turns is negligibly small and the plane of each loop is perpendicular to the axis of the solenoid.
Consider ABCD as an Amperian loop
$ \displaystyle \oint \vec{B}.\vec{dl} = \mu_0 I $
$ \displaystyle \int_{A}^{B} \vec{B}.\vec{dl} + \int_{B}^{C} \vec{B}.\vec{dl} + \int_{C}^{D} \vec{B}.\vec{dl} + \int_{D}^{A} \vec{B}.\vec{dl}= \mu_0 I $
Solenoid is the combination of circular loops. If the solenoid is ideal B is only along the axis and outside the solenoid, B is zero. AB, and CD are perpendicular to , hence
$ \displaystyle 0 + \int_{B}^{C} \vec{B}.\vec{dl} + 0 + 0 = \mu_0 I $
$ \displaystyle \int_{B}^{C} \vec{B}.\vec{dl} = \mu_0 I $
If number of turns per unit length of solenoid is n and length of BC is l then I = nli And hence
$ \displaystyle B l = \mu_0 (n l i) $
$ \displaystyle B = \mu_0 (n i) $
This result is applicable for any point in the central part of the solenoid.
At the ends of solenoid,
$ \displaystyle B = \frac{\mu_0 (n i)}{2} $
Exercise A solenoid of length 2 m and of radius 1 cm has an winding having a current of 0.1 ampere per turn. Find the magnetic field strength inside the solenoid if the total number of turns is 2000.