Luke fights Darth Vader in the presence of the Emperor. New backstory: the only reason Luke wins is because he had the Emperor's help, who was doing Battle Meditation to help Luke and hinder Vader. The helps explain how a neophyte Jedi could defeat one of the most powerful Sith.
The Emperor then attempts to single-handedly turn or kill Luke, but fails. He might have succeded if he and Vader worked together, but it was perhaps a strategic error to have just betrayed Vader setting him up for slaughter. Vader was in no mood to help. (It is quite unlike the Emperor to make strategic errors. Can this be explained? Maybe someone was doing Battle Meditation against him. Maybe he hadn't expected Luke to defeat but not kill Vader, introducing an unexpected extra variable.)
Vader turns and kills the Emperor. Normally, this would not have been possible (we assume the Emperor is stronger, or else the tables would have been turned already) but essentially Luke and Vader were working together: Luke was busy Force-resisting the Emperor's lightning bolts, sapping the Emperor's strength.
We see essentially all possibilities of any 2 being able to defeat the remaining 1. This had already been hinted at in "Together we can rule the galaxy as father and son."