While in the third episode, The Final Problem, she is revealed to be the third Holmes sibling, Eurus Holmes Brooke talks about playing the four roles and how having worked with Benedict Cumberbatch in Hamlet helped with the chemistry between the two.
https://youtu.be/dQCUCBuAl7UVideo can't be loaded because JavaScript is disabled: Sian Brooke Interview | Sherlock (https://youtu.be/dQCUCBuAl7U)
[...]