Geometry textbooks always try to trick you by adding decorative stripes and dotted lines.
If you’re having trouble getting the formulas behind the joke, please see https://www.explainxkcd.com/wiki/index.php/2509:_Useful_Geometry_Formulas.
I really liked xkcd’s take on numerical analysis and error propagation:
A good mathematical explanation of this comic can be found here: https://www.explainxkcd.com/wiki/index.php/2295:_Garbage_Math
A brief explanation can be found at https://www.explainxkcd.com/wiki/index.php/2303:_Error_Types.