Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bayhaqi:9786And ʾNbʾ Ibn Khuzaymah > Muḥammad b. Yaḥyá > Muḥammad b. Yūsuf > ʿUmar b. Dhar > Mujāhid > Ibn ʿAbbās

[Machine] If he (or she) has sexual intercourse, then each of them is required to perform a ritual purification.  

البيهقي:٩٧٨٦قَالَ وَأنبأ ابْنُ خُزَيْمَةَ ثنا مُحَمَّدُ بْنُ يَحْيَى أنبأ مُحَمَّدُ بْنُ يُوسُفَ ثنا عُمَرُ بْنُ ذَرٍّ عَنْ مُجَاهِدٍ عَنِ ابْنِ عَبَّاسٍ قَالَ

إِذَا جَامَعَ فَعَلَى كُلِّ وَاحِدٍ مِنْهُمَا بَدَنَةٌ