Origins
The word 'yes' has an etymology that reveals a lost grammatical distinction in English. It descends from Old English 'gēse' or 'gīse,' widely analyzed as a contraction of 'gēa' (yea) + 'sīe' (let it be, may it be so), where 'sīe' is the third-person singular subjunctive of the verb 'bēon' (to be). The literal meaning was 'yea, may it be so' — an emphatic affirmation that invoked a wish for the affirmed proposition to hold true.
The most linguistically interesting aspect of 'yes' is that in Old English and Middle English, it was not interchangeable with 'yea.' The two words belonged to a four-part answer system common in many older Germanic languages. 'Yea' (gēa) was the affirmative answer to a positive question: 'Is he coming?' — 'Yea' (he is). 'Nay' was the negative answer to a positive question: 'Is he coming?' — 'Nay' (he is not). 'Yes' (gēse) was the affirmative answer to a negative question: 'Is he not coming?' — 'Yes' (on the contrary, he is). 'No' (nā) was the negative answer to a negative question: 'Is he not coming?' — 'No' (correct, he is not). In other words, 'yea' confirmed and 'yes' contradicted; the choice depended on the polarity of the question.
This system survives in modern French, which distinguishes 'oui' (yes, affirming a positive) from 'si' (yes, contradicting a negative). German preserves it partially with 'doch' (contradicting a negative statement). But English lost the distinction gradually during the Early Modern period. Shakespeare still occasionally uses 'yea' and 'yes' with their original distinct functions, but by the 17th century the two had merged, with 'yes' becoming the all-purpose affirmative and 'yea' retreating to archaic or formal registers.
Proto-Indo-European Roots
The 'gēa/yea' element of 'yes' traces to Proto-Germanic *ja (yes, indeed), which is the ancestor of German 'ja,' Dutch 'ja,' Swedish 'ja,' and Danish 'ja.' The PIE origin is usually given as *yē, an emphatic or affirmative particle, though this reconstruction rests primarily on the Germanic evidence. The Germanic affirmation particle stands in contrast to the Italic branch, where Latin had no single word for 'yes' — Romans affirmed by repeating the verb ('Is he coming?' — 'He is coming') or using particles like 'ita' (so), 'sīc' (thus, which became French 'si'), or 'hōc ille' (this he [did], which became French 'oui' through Old French 'oïl').
The informal variants 'yeah,' 'yep,' 'yup,' and 'aye' all trace to the same Germanic root *ja, with various informal phonological modifications. 'Yeah' preserves the 'yea' form with a casual open vowel. 'Yep' and 'yup' add a bilabial stop for emphatic closure. The diversity of informal affirmatives in English reflects the high frequency and social importance of the affirmation function — speakers constantly innovate new ways to say 'yes' that carry different registers, attitudes, and degrees of enthusiasm.