Mishnah for Sanhedrin 2:3
מֵת לוֹ מֵת, אֵינוֹ יוֹצֵא מִפֶּתַח פַּלְטְרִין שֶׁלּוֹ. רַבִּי יְהוּדָה אוֹמֵר, אִם רוֹצֶה לָצֵאת אַחַר הַמִּטָּה, יוֹצֵא, שֶׁכֵּן מָצִינוּ בְדָוִד שֶׁיָּצָא אַחַר מִטָּתוֹ שֶׁל אַבְנֵר, שֶׁנֶּאֱמַר (שם ג) וְהַמֶּלֶךְ דָּוִד הֹלֵךְ אַחֲרֵי הַמִּטָּה. אָמְרוּ לוֹ, לֹא הָיָה הַדָּבָר אֶלָּא לְפַיֵּס אֶת הָעָם. וּכְשֶׁמַּבְרִין אוֹתוֹ, כָּל הָעָם מְסֻבִּין עַל הָאָרֶץ וְהוּא מֵסֵב עַל הַדַּרְגָּשׁ:
If one of his kin dies, he does not leave the portal of his palace, [it being demeaning for a king to show a mournful countenance to the people]. R. Yehudah says: If he wishes to follow the litter, he may do so, viz. (II Samuel 3:31): "And King David walked behind the litter." They countered: He did so only to appease the people, [so that they recognize that David had not counseled Yoav to kill Avner.] And when they give him the mourner's meal, everyone sits on the ground, and he sits on the bed.