In Act 2, Scene 2, Viola realizes that Olivia has fallen in love with her masculine disguise and delivers a soliloquy lamenting the absurdity of her situation. This complicated soliloquy is rich with literary devices, including allusion, personification, and metaphor.
Having understood the meaning of Olivia's ring, Viola bemoans the impossibility of Olivia's love for her, which can be read as a lament about the impossibility of same-sex attraction as a whole:
Viola: Poor lady, she were better love a dream.
The relationship between Olivia and Viola can be read as an allusion to the myth of Iphis and Ianthe, which is recounted in Ovid's Metamorphoses. According to Ovid, Iphis was born in Crete to parents Telethusa and Ligdus. While Telethusa was pregnant, Ligdus resolved to kill the child if it was a girl, since he would be too poor to afford her dowry. The child was indeed born a girl, but Telethusa, with the aid of the goddess Isis, successfully concealed the baby's sex from her husband and raised her as a boy. When Iphis reached adulthood, Ligdus arranged for her to be married to a young woman named Ianthe. The two women fell deeply in love with each other, but Iphis despaired that a marriage between two women was impossible. The goddess Isis, taking pity on the two lovers, transformed Iphis into a man.
Just as Ianthe falls in love with Iphis, not knowing that she is a woman in disguise, Olivia falls in love with Cesario, unaware that she is actually Viola. And Viola, like Iphis, is symbolically "transformed" into a man when her identical brother Sebastian takes her place as Olivia's beloved.
Following this classical allusion is a reference to Christianity:
Viola: Disguise, I see thou art a wickedness
Wherein the pregnant enemy does much.
By alluding to the Devil, Viola is possibly referencing the fact that Eve, the first woman, was deceived by the serpent in the Garden of Eden. Viola may view herself in the role of the deceiving serpent, a comparison that is made more fitting by the fact that serpents are viewed as phallic symbols in some cultures.
Later in the monologue, Viola also alludes to the myth of Hermaphroditus:
Viola: And I, poor monster, fond as much on him,
And she, mistaken, seems to dote on me.
In Shakespeare's time, individuals of ambiguous sex and gender were viewed as monsters. This view comes in part from the myth of Hermaphroditus. According to Ovid's Metamorphoses, Hermaphroditus was the remarkably handsome son of the love goddess Aphrodite and the trickster god Hermes. A licentious nymph named Salmacis fell in love with Hermaphroditus, and when he rebuffed her advances, she attempted to rape him. During the assault, she begged the gods to unite the two of them forever. In response, the gods merged their bodies into one, creating the first hermaphrodite.
This myth is unusual because it depicts a woman as the lover/aggressor and the man as the beloved/victim. In Twelfth Night, Olivia actively pursues Cesario, who does not return her affections, inverting the usual gender roles of courtship.
In addition to classical and biblical allusions, Viola's soliloquy contains several instances of metaphor and personification. At one point, Viola compares women's hearts to wax, which deceitful men can easily mold:
How easy is it for the proper false
In women’s waxen hearts to set their forms!
Lamenting her predicament, which she compares to a complicated knot, she personifies Time and calls upon them for aid:
Viola: O Time, thou must untangle this, not I.
It is too hard a knot for me t’ untie.
This soliloquy also contains one important line that has been persistently misprinted:
Viola: Alas, our frailty is the cause, not we,
For such as we are made of, such we be.
In most modern versions of Twelfth Night, Viola says "OUR frailty," but in the original version of the play published in the 1623 First Folio, the line instead reads "O frailty." In the original version, Viola seems to be making a comment on the frailty of humankind as a whole, but when the line is changed to "our," she is suddenly making a comment on the frailty of women specifically. Considering the fact that Twelfth Night is populated by a number of assertive, dynamic women, it seems especially unfair that Shakespeare's words have been twisted in this manner.
Sebastian's soliloquy at the beginning of Act 4, Scene 3 is the first real insight that the audience gets into his character. The speech establishes Sebastian as a logical individual who is nonetheless choosing to enjoy the strange but wonderful aspects of his situation.
At the beginning of the soliloquy, Sebastian makes use of visual and tactile imagery:
Sebastian: This pearl she gave me, I do feel ’t and see ’t.
And though ’tis wonder that enwraps me thus,
Yet ’tis not madness.
Sebastian cannot be hallucinating, he reasons, because he can feel and see the pearl that Olivia gave him. Although he trusts his senses to a degree, he can't shake the feeling that something is wrong:
For though my soul disputes well with my sense
That this may be some error, but no madness,
Yet doth this accident and flood of fortune
So far exceed all instance, all discourse,
That I am ready to distrust mine eyes
And wrangle with my reason that persuades me
To any other trust but that I am mad—
Or else the lady’s mad.
He eventually convinces himself that, although his situation is quite unusual, neither he nor Olivia are insane:
Sebastian: Yet if ’twere so,
She could not sway her house, command her
Take and give back affairs and their dispatch
With such a smooth, discreet, and stable bearing
As I perceive she does.
Sebastian's conclusion comes about as a result of his use of logos: insane people cannot adequately run households; Olivia adequately runs hers; ergo, she cannot be mad.
This soliloquy serves as a sort of spiritual opposite to the "Is this a dagger which I see before me" soliloquy in Macbeth. In that play, Macbeth wonders whether the vision of the bloody dagger he sees is real or not, since he can see but not touch it, and ultimately decides that it is a hallucination brought on by his guilt. In Twelfth Night, by contrast, Sebastian concludes that he is not mad because he can both see and touch the pearl that Olivia has given him, but he remains suspicious that all is not as it seems.