In Sanskrit texts, Rāja yoga () was both the goal of yoga and a method of attaining it. The term also became a modern name for the practice of yoga, when in the 19th-century Swami Vivekananda equated raja yoga with the Yoga Sutras of Patanjali. Since then, Rāja yoga has variously been called aṣṭāṅga yoga, royal yoga, royal union, sahaja marg, and classical yoga.
Rāja (Sanskrit: राज) means "chief, best of its kind" or "king". Rāja yoga thus refers to "chief, best of yoga".
The historical use of the term Rāja yoga is found in other contexts, quite different than its modern usage. In ancient and medieval Sanskrit texts, it meant the highest state of yoga practice (one reaching samadhi). Hatha Yoga Pradipika, for example, refers to Hathayoga as one of the ways to achieve Rāja yoga.
The first known use of the phrase "Rāja yoga" occurs in a 16th-century commentary on a specific step in the Yoga Sūtras of Patañjali. The Hindu scholar Dattatreya, in his medieval era Tantric work named "Yogaśāstra", explains in 334 shlokas, principles of four yoga: Mantra yoga, Hatha yoga, Laya yoga and Raja yoga. Alain Daniélou states that Rāja yoga was, in the historic literature of Hinduism, one of five known methods of yoga, with the other four being Hatha yoga, Mantra yoga, Laya yoga and Shiva yoga. Daniélou translates it as "Royal way to reintegration of Self with Universal Self (Brahman)".
The term became a modern retronym when in the 19th-century Swami Vivekananda equated raja yoga with the Yoga Sūtras of Patañjali. This sense of meaning is different from Hatha Yoga Pradīpikā, a text of the Natha sampradaya, where it is a different practice.
Modern interpretations and literature that discusses Raja yoga often credit Patañjali's Yogasūtras as its textual source, but many neither adopt the teachings nor the philosophical foundations of the Yoga school of Hinduism. This mixing of concepts has led to confusion in understanding historical and modern Indian literature on Yoga.
The Shaiva Yoga text, Amanaska, dated to be from the 12th century CE or earlier, is a dialogue between Vamadeva and deity Shiva. In the second chapter, the text mentions Raja yoga, and explains why it is called so. It states that it is so named because it enables the yogin to reach the illustrious king within oneself, the supreme self. Raja yoga is declared as the goal where one experiences nothing but the bliss of the undisturbed, the natural state of calm, serenity, peace, communion within and contentment.
राजयोगः समाधिश्छ उन्मनी छ मनोन्मनी | अमरत्वं लयस्तत्त्वं शून्याशून्यं परं पदम || ३ ||
अमनस्कं तथाद्वैतं निरालम्बं निरञ्जनम | जीवन्मुक्तिश्छ सहजा तुर्या छेत्येक-वाछकाः || ४ ||
सलिले सैन्धवं यद्वत्साम्यं भजति योगतः | तथात्म-मनसोरैक्यं समाधिरभिधीयते || ५ ||
यदा संक्ष्हीयते पराणो मानसं छ परलीयते | तदा समरसत्वं छ समाधिरभिधीयते || ६ ||
तत-समं छ दवयोरैक्यं जीवात्म-परमात्मनोः | परनष्ह्ट-सर्व-सङ्कल्पः समाधिः सोअभिधीयते || ७ ||
Raja yoga, samadhi, unmani, manonmani, amaratva, laya, tatva, sunya, asunya, parama pada,
amanaska, advaita, niralamba, niranjana, jivanmukti, sahaja and turiya denote the same state of being.
Just as with salt dissolved in water becomes one with it, so the union of Atman and Manas (mind) is denominated samadhi,
When the breath becomes exhausted, and mind becomes Praliyate (still, reabsorbed), they fuse into union called samadhi.
This equality, this oneness of the two, the living self and the absolute self, when all Sankalpa (desire, cravings) end is called samadhi.
Some medieval era Indian texts on Yoga list Rajayoga as one of many types of yoga. For example, the Sarvanga yoga pradipikå, a Braj-bhashya commentary by Sundardas, from the 17th-century, teach three tetrads of Yogas. The first group is Bhakti yoga, Mantra yoga, Laya yoga, and Carcha yoga; the second group is Hatha yoga, Raja yoga, Laksha yoga, and Astanga yoga; the third is Samkhya yoga, Jñana yoga, Brahma yoga, and Advaita yoga. Of these twelve, Sundardas states that Rajayoga is the best yoga.
One meaning of Raja yoga is as a modern retronym introduced by Swami Vivekananda, when he equated raja yoga with the Yoga Sutras of Patanjali. After its circulation in the first half of 1st millennium CE, many Indian scholars reviewed it, then published their Bhāṣya (notes and commentary) on it, which together form a canon of texts called the Pātañjalayogaśāstra ("The Treatise on Yoga of Patañjali").
According to Axel Michaels, the Yoga Sutras are built upon fragments of texts and traditions from ancient India. According to Feuerstein, the Yoga Sutras are a condensation of two different traditions, namely "eight limb yoga" (ashtanga yoga) and action yoga (kriya yoga). The kriya yoga part is contained in chapter 1, chapter 2 verse 1-27, chapter 3 except verse 54, and chapter 4. The "eight limb yoga" is described in chapter 2 verse 28-55, and chapter 3 verse 3 and 54.
There are numerous parallels in the concepts in ancient Samkhya, Yoga and Abhidharma schools of thought, particularly from 2nd century BCE to 1st century AD, notes Larson. Patanjali's Yoga Sutras may be a synthesis of these three traditions. From Samkhya school of Hinduism, Yoga Sutras adopt the "reflective discernment" (adhyavasaya) of prakrti and purusa (dualism), its metaphysical rationalism, as well its three epistemic methods to gaining reliable knowledge. From Abhidharma Buddhism's idea of nirodhasamadhi, suggests Larson, Yoga Sutras adopt the pursuit of altered state of awareness, but unlike Buddhism which believes that there is neither self nor soul, Yoga is physicalist and realist like Samkhya in believing that each individual has a self and soul. The third concept Yoga Sutras synthesize into its philosophy is the ancient ascetic traditions of isolation, meditation and introspection, as well as the yoga ideas from the 1st millennium BCE Indian texts such as Katha Upanishad, Shvetashvatara Upanishad and Maitri Upanishad.
In early 11th century, the Persian scholar Al Biruni visited India, lived with Hindus for 16 years, and with their help translated several significant Sanskrit works into Arabic and Persian languages. One of these was Patanjali's Yogasutras. Along with generally accurate translations, Al Biruni's text has significant differences than Yogasutra manuscripts discovered in India, during the 19th century. Al Biruni's record has helped modern scholars establish that Patanjali's Yogasutras manuscript existed in India in many versions, each with multiple commentaries by Hindu scholars. Some of these versions and commentaries have been lost or yet to be found. Al Biruni's translation preserved many of the core themes of Yoga philosophy of Hinduism, but certain sutras and analytical commentaries were restated making it more consistent with Islamic monotheistic theology. Al Biruni's version of Yoga Sutras reached Persia and Arabian peninsula by about 1050 AD.
In Indian historical timeline, marking with the arrival of Islam in India in twelfth century, further development and literature on Yoga philosophy of Hinduism went into decline. By the sixteenth century, Patanjali's Yoga philosophy was nearly extinct. Yoga was preserved by sadhus (ascetics, sannyasis) of India. Some of the Hindu yoga elements were adopted by Sufi sect of Muslims in India. The Sufi Muslims at times adopted and protected the Yoga tradition of Hindus during the Islamic rule of India, and at other times helped the persecution and violence against those Hindus. The Mughal Emperor Akbar, known for his syncretic tolerance, was attracted to and patronized Yoga philosophy of Hinduism.
The yoga scholar Stephen Cope identifies the following similarities between Raja yoga and Buddhism. He notes that the two philosophies are not the same, but are strikingly similar, having shared a long period of interchange up to about 500 CE.