And based on the words of Masekhet Soferim, the Tosafot, the Tur, and the Shulchan Aruch wrote that the firstborns fast on the eve of Pesach, whether a firstborn from the father or a firstborn from the mother. For anyone upon whom the name "firstborn" applies, whether a firstborn for inheritance such as from the father or a firstborn for the kohen such as a firstborn to the mother—he fasts. For in Egypt all types of firstborns were killed, whether from the father or from the mother, as Rashi explained on the verse "for there was no house where there was not someone dead." And even the head of the household is called "firstborn," see there in Rashi. And in Psalms (78) it is written: "And He smote every firstborn in Egypt, the first of their strength in the tents of Ham." And "the first of his strength" is a firstborn from the father, as it is written: "for he is the first of his strength, the right of the firstborn is his." And Yaakov said regarding Reuven: "my might and the first of my strength." And despite all this, the Holy One, Blessed be He, did not command to sanctify firstborns except for a firstborn from the mother, because he is "the first to open the womb." And it seems to me the reason is because the Holy One, Blessed be He, sanctified "from the firstborn of man unto the firstborn of beast," and regarding a beast only "the first to open the womb" is relevant, as is understood. Therefore, regarding man as well, only the first to open the womb was sanctified.
ועל פי דברי המסכת סופרים, כתבו התוספות והטור והשולחן ערוך שהבכורים מתעניין בערב פסח, בין בכור מאב בין בכור מאם. דכל מי ששם "בכור" עליו, או בכור לנחלה כמו מאב או בכור לכהן כמו בכור לאם – מתענה. דבמצרים נהרגו כל מיני בכורים, בין מאב בין מאם, כמו שפירש רש"י על פסוק "כי אין בית אשר אין שם מת". וגם גדול הבית מקרי "בכור", עיין שם ברש"י. ובתהלים (עח) כתיב: "ויך כל בכור במצרים, ראשית אונים באהלי חם". ו"ראשית אונו" הוא בכור מאב, כדכתיב: "כי הוא ראשית אונו, לו משפט הבכורה". ויעקב אמר על ראובן: "כחי וראשית אוני". ועם כל זה לקדש בכורות לא צוה הקדוש ברוך הוא רק על בכור מאם, מפני שהוא "פטר רחם". ונראה לי הטעם משום דהקדוש ברוך הוא קידש "מבכור אדם ועד בכור בהמה", ובבהמה לא שייך רק "פטר רחם" כמובן. ולכן גם באדם לא נתקדש רק הפטר רחם.