Derivation of B formula for loop

let's have a go at this calculation of the magnetic field in the centre of a loop of wire carrying a current $I$. Assume the radius of the loop is $R$ meters.

The direction of $\vec{B}_{centre}$ we can find by using the first right-hand rule. Grab the loop of wire with your thumb pointing in the the direction of the current and look at the direction in which you fingers point inside the loop. It will be either up or down, depending on whether the current is flowing counter-clockwise or clockwise when looking at the loop from above.

Next we want to find the magnetic field strength in the centre. The centre is, by definition, at the same distance ($R$ meters) from all the pieces of current flow.

Recall the general equation for the Biot–Savart law: \[ \vec{B}(\vec{r}) = \int_\mathcal{L}\frac{\mu_0}{4\pi} \frac{I}{|\vec{r}|^2} d\mathbf{l} \times {\hat r}. \] In our case $\mathcal{L}$ is the loop. The total length of the loop is $L=2\pi R$, or if you want to impress your friends you can say the same thing as: \[ \int_\mathcal{L} d\mathbf{l} = 2\pi R, \] which says that if you add all the infinitesimal pieces of length ($d\mathbf{l}$) you get the total circumference of the loop.

Derivation of B formula for solenoid