If V is the velocity of flow at any section, the head loss for small length 'dx' of the pipe, then head loss for the section 'dx' is given by,
Integrating,