Praise be to Allah.
It is recommended to fast nine days of Dhul-Hijjah
Fasting nine days of Dhul-Hijjah is mustahabb (recommended). This is indicated by the words of the Prophet (peace and blessings of Allah be upon him), as narrated in the hadeeth of Ibn 'Abbas (may Allah be pleased with him):
“There are no days on which righteous deeds are more beloved to Allah than these ten days – i.e., ten days of Dhul-Hijjah).” They said: “O Messenger of Allah, not even jihad for the sake of Allah?” He said: “Not even jihad for the sake of Allah, unless a man goes out himself with his wealth and does not come back with anything (i.e., he expends all his wealth and is martyred).” (Narrated by al-Bukhari, 969)
And it was narrated from Hunaydah ibn Khalid from his wife that one of the wives of the Prophet (peace and blessings of Allah be upon him) said: “The Messenger of Allah (peace and blessings of Allah be upon him) used to fast nine days of Dhul-Hijjah and the day of ‘Ashura’ and three days of each month – the first Monday and two Thursdays.” (Narrated by Imam Ahmad, 21829; Abu Dawood, 2437; classed as da’eef in Nasb al-Raayah, 2/180, but classed as saheeh by al-Albani.)
Fasting on the day of ‘Eid is prohibited
With regard to fasting on the day of ‘Eid, this is haram (prohibited), as is indicated by the marfoo’ hadeeth of Abu Sa’eed al-Khudri (may Allah be pleased with him): “He [the Prophet (peace and blessings of Allah be upon him)] forbade fasting on the day of ‘Eid) al-Fitr and the day of al-Nahr (the day of sacrifice, i.e., ‘Eid al-Adha).” (Narrated by al-Bukhari, no. 1992; Muslim, 827)
The scholars are unanimously agreed that it is haram to fast on these days.
Righteous deeds on these ten days are better than on others. With regard to fasting, that should only be done on nine of them; the tenth day is the day of ‘Eid when it is haram to fast.
Based on this, what is meant by the virtue of fasting the ten days of Dhul-Hijjah is fasting nine days only, even though they are called ten days.
And Allah knows best.
Sharh Muslim by al-Nawawi, hadeeth no. 1176.