The Śatakatraya (Sanskrit: शतकत्रय, "the three śatakas", also known in Southern India sometimes as सुभाषित त्रिशति Telugu: సుభాషిత త్రిశతి IAST: subhāṣita triśati ,"the three hundred poems of moral values") refers to three Indian collections of Sanskrit poetry, containing a hundred verses each. The three śatakas, or "centuries", are known as the Nītiśataka, Śṛṅgāraśataka, and Vairāgyaśataka, and are attributed to Bhartṛhari.
K. M. Joglekar in his book on Nītiśataka says that it is not easy to say in which order the Śatakas were written.
The Nītiśataka deals with nīti, roughly meaning ethics and morality. Śṛṅgāraśataka deals with love and women. Vairāgyaśataka contains verses on renunciation. The Sanskrit scholar Barbara Stoler Miller translated these sections as Among Fools and Kings, Passionate Encounters and Refuge in the Forest respectively.
Especially in the Vairāgyaśataka, but also in the other two, his poetry displays the depth and intensity of his renunciation as he vacillates between the pursuits of fleshly desires and those of the spirit. Thus it reveals the conflict experienced "between a profound attraction to sensual beauty and the yearning for liberation from it", showing how "most great Indian art could be at once so sensuous and so spiritual".
There is great variation between versions of his Śatakas, and together the available manuscripts have over 700 verses instead of 300. D. D. Kosambi identified about 200 verses that appear in all manuscripts. Despite the variation in content, there is remarkable similarity in theme; Kosambi believes that each śataka came to attract a certain type of stanza similar to the ones present in the original collection. Moreover, at least among the 200 "common" stanzas, there is a distinctive voice of irony, scepticism and discontent, making the attribution to a single author plausible.
According to one legend associated with him (possibly in confusion with the legend of king Bharthari), he was a king, who once gave a magic fruit to his wife, who gave it to another man, who in turn gave it to another woman, and finally it reached the king again. Reflecting on these events, he realised the futility of love and worldly pleasures, renounced his kingdom, retired to the forest, and wrote poetry. This is connected with a famous verse that appears in the collections: