“Solitude” is an 1883 poem by Ella Wheeler Wilcox which begins with these lines:
Laugh, and the world laughs with you;
Weep, and you weep alone;
For the sad old earth must borrow its mirth,
But has trouble enough of its own.
There was a question on this on today’s edition of “The Chase”. I did not know the answer – but I did recall something similar in Vanity Fair by William Makepeace Thackeray:
The world is a looking-glass, and gives back to every man the reflection of his own face. Frown at it, and it will in turn look sourly upon you; laugh at it and with it, and it is a jolly kind companion; and so let all young persons take their choice.
It comes from in Chapter II of the novel.