What is the theory for a two-part melody?
When both parts are the same why have two notes when you only play them once?
Thank you in advance.
The theory is just that, 2 different melodies going on at the same time. The stems represent which voice part is singing what note, as sjon explained. Soprano notes stem up, and Alto notes stem down. Both parts are written on the treble clef. If there were 4 parts to it, then in the bass clef u would have Tenor and Bass notes. Tenor notes stem up, and the Bass notes stem down.
If you were to go to a real theory class, you would learn that there all all kinds of rules of how to write in 4 parts. Things like all voices move opposite the Bass, no direct 5ths or octaves unless one voice steps and another voice jumps, root movement as much as possible, go to the nearest tone, etc.