what is the purpose of shaving your head
Allah Says in the Holy Quran Chapter 2 Surah Baqarah verse 196:
And complete the Hajj or `Umra in the service of Allah. But if ye are prevented (from completing it) send an offering for sacrifice such as ye may find, and do not shave your heads until the offering reaches the place of sacrifice. And if any of you is ill or has an ailment in his scalp (necessitating shaving) (he should) in compensation either fast or feed the poor or offer sacrifice; and when ye are in peaceful conditions (again) if anyone wishes to continue the 'Umra on to the Hajj he must make an offering such as he can afford, But if he cannot afford it, he should fast three days during the Hajj and seven days on his return making ten days in all. This is for those whose household is not in (the precincts of) the Sacred Mosque. And fear Allah and know that Allah is strict in punishment.
In light of the above command of Allah Subhanah, shaving or cutting the hair short is an obligatory part of the Hajj and Umrah pilgrimage.
Sahih Al-Bukhari Hadith 2.786 Narrated by Abu Huraira
The Messenger of Allah (saws) said, "O Allah! Forgive those who get their heads shaved." The people asked. "Also those who get their hair cut short?" The Prophet (saws) said, "O Allah! Forgive those who have their heads shaved." The people said, "Also those who get their hair cut short?" The Prophet (saws) at the third time said, "(O Allah) also (forgive) those who get their hair cut short."
In light of the above authentic hadith, shaving the head is preferred over cutting the hair short at the pilgrimage of Hajj or Umrah; but if one cuts his hair short, it would suffice.