A mathematical solution for the formation of halo