I was recently asked this question as in the title.
It does not seem like easy math, as happiness and sadness are hard to quantify and mathematically compare.
………………………………………………………………. (Graph generated with Craiyon)
Interesting enough, however, there are research reports on this, some with sophisticated mathematics.
Here is an example. According to this research, we need at least 2.9 times as much happiness as sadness, or a roughly 3 : 1 ratio of (positive emotions) : (negative emotions), to be flourishing. Between 1 : 1 and ~3 : 1, where we have more positive emotions than, but not quite enough to overcome, the negative ones, we are just languishing, though not depressed or distressed (< 1 : 1), but also not flourishing (> 3 : 1).
The 2.9 : 1, or ~3 : 1, ratio is from a mathematical model based on data collected among research participants. I would say that in real life, it might or might not be exactly that, and it may vary more or less for each individual. But a point was well made, that we do need more, perhaps multiple times more, positive emotions to overcome, or “make up for”, the effects of negative emotions. The reason behind it is in our conventional wisdom: Bad is stronger than good.
This also brings to our attention the concept of Positivity Ratio, or using the wording in the question, the amount of happiness over that of sadness. This ratio is important for our overall mental state and emotional well-being. As discussed above, it is an indicator of whether you are flourishing, languishing, or worse.
Want to know your Positivity Ratio? There are scientific methods to measure it, and we offer that for free for our subscribers here. You are welcome to use this service (subscribe and request for this and many other happiness or well-being related scientific measurements to determine your personal levels!)