When it comes to being written, sarcasm (what this is a case of) is very difficult to understand. There is no easy way to determine if (when written) the speaker meant this in the literal sense or to be sarcastic, though some tips would be to watch for punctuation:
for instance, any use of ellipses (...) usually imply sarcasm:
"Yeah, right..."
"Yeah... Right"
While any use of exclamation points (!) would likely imply the literal use
"Yeah! Right!"
"Yeah, right!"
When spoken aloud, however, it becomes easier to understand. A person being sarcastic will commonly draw out the words such as
"Yeaaahh Riiigghht"
Or use inflection such that the start of each word is articulated more than the finish:
"YEAah RIGht"
This is a very difficult question to answer well, it would be easier to ask a native speaker to explain "Sarcasm" to you than to try to understand it through text. Just know that without context (knowing that 1+1=3) even native speakers have trouble knowing if it is sarcasm or not when written down.