Original Text
maitri karuna mudita upeksanam sukha duhkha punya apunya visayanam bhavanatah citta prasadanam
Translation
By cultivating friendliness toward those who are happy, compassion toward those who are suffering, joy toward those who live skillfully, and equanimity toward those who cause harm, the mind becomes clear and serene.
Background
The Brahma Viharas, also known as the Four Divine Abodes, are cultivated in both Buddhist and yogic traditions. These are sometimes known as the practice of the "four locks and four keys"
Edwin Bryant (The Yoga Sūtras of Patañjali, 2009) writes, "This sūtra prescribes a kind of mindfulness or mental cultivation off the mat, so to speak, that is, in day-to-day affairs outside of the context of citta-vṛtti-nirodha–type meditation. Cultivating the higher qualities of sattva is a continuous and constant requirement of the yogic path and spills over into all aspects of life’s affairs and social interactions. It speaks to the fact that yoga need not be perceived as a world-renouncing tradition but is perfectly compatible with engaged and benevolent social action in the world."