The message, which was posted on Instagram and Twitter, reads: "'May flights of Angels sing thee to thy rest.’ In loving memory of Her Majesty The Queen. 1926 – 2022."
It was posted with a previously unseen photograph of the queen walking through heathlands on a grey day at Balmoral in 1971. It was taken by Patrick Anson, 5th Earl of Lichfield, who was a cousin of the queen's and the photographer at King Charles III's wedding to Diana, Princess of Wales.
The Hamlet quote, "May flights of Angels sing thee to thy rest," comes from Act 5 Scene 2, the final scene of the Shakespeare play. It is spoken by Horatio, who is paying tribute to his dying friend, Hamlet, Prince of Denmark.
The full quote reads: "Now cracks a noble heart. Good night, sweet prince, and flights of angels sing thee to thy rest."
Extraordinary moments at the funeral of Queen Elizabeth II — in pictures
The quote is popularly used in tributes when someone dies, and was the final line of King Charles III's first address after his mother Queen Elizabeth II died.
In the play, the relationship between Hamlet and his mother, Gertrude, Queen of Denmark, is a turbulent one. Their fallout is rooted in the fact Hamlet resents Gertrude for marrying King Claudius, the brother of her first husband and Hamlet's father.
However, the complex interfamilial relationships in Hamlet have not affected the quote's popularity in paying tribute to the dead.
When Vangelis, the Greek composer of the Chariots of Fire and Blade Runner soundtrack, died in May, Elon Musk used the quote to pay tribute to him on Twitter.
"Good night, sweet maestro, and flights of angels sing thee to thy rest," Musk wrote.