<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.explainxkcd.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=HappyDog</id>
		<title>explain xkcd - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://www.explainxkcd.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=HappyDog"/>
		<link rel="alternate" type="text/html" href="https://www.explainxkcd.com/wiki/index.php/Special:Contributions/HappyDog"/>
		<updated>2026-05-04T01:52:26Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https://www.explainxkcd.com/wiki/index.php?title=2295:_Garbage_Math&amp;diff=190955</id>
		<title>2295: Garbage Math</title>
		<link rel="alternate" type="text/html" href="https://www.explainxkcd.com/wiki/index.php?title=2295:_Garbage_Math&amp;diff=190955"/>
				<updated>2020-04-20T07:40:33Z</updated>
		
		<summary type="html">&lt;p&gt;HappyDog: /* Explanation */ Removing note about Covid streak, as it's a bit of a stretch to describe 2293 as 'about Covid'.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{comic&lt;br /&gt;
| number    = 2295&lt;br /&gt;
| date      = April 17, 2020&lt;br /&gt;
| title     = Garbage Math&lt;br /&gt;
| image     = garbage_math.png&lt;br /&gt;
| titletext = 'Garbage In, Garbage Out' should not be taken to imply any sort of conservation law limiting the amount of garbage produced.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Explanation==&lt;br /&gt;
{{incomplete|Created by a ZILOG Z80. Please mention here why this explanation isn't complete. Do NOT delete this tag too soon.}}&lt;br /&gt;
&lt;br /&gt;
This comic explains the &amp;quot;{{w|garbage in, garbage out}}&amp;quot; concept using arithmetical expressions. Just like the comic says, if you get garbage in any part of your workflow, you get garbage as a result. Except when you multiply by zero. That one always fixes everything.&lt;br /&gt;
&lt;br /&gt;
Some of these rules correspond to the rules of {{w|floating point arithmetic}}, while others may be inspired by the rules of {{w|Propagation_of_uncertainty#Example_formulae| propagation of uncertainty}} where a &amp;quot;garbage&amp;quot; number would correspond to an estimate with a high degree of uncertainty, and the uncertainty of the result of arithmetic operations will tend to be dominated by the term with the highest uncertainty. The rule about N pieces of independent garbage reflects the {{w|central limit theorem}} and how it predicts that the uncertainty (or {{w|standard error}}) of an estimate will be reduced when independent estimates are averaged.&lt;br /&gt;
&lt;br /&gt;
This comic is about the propagation of errors in numerical analysis and statistics, but described in much more colloquial terms. Numbers with low precision are termed &amp;quot;garbage&amp;quot; and numbers with high precision are labeled &amp;quot;precise&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Formula as shown&lt;br /&gt;
!Resulting variance&lt;br /&gt;
!Explanation&lt;br /&gt;
|-&lt;br /&gt;
|Precise number + Precise number = Slightly less precise number&lt;br /&gt;
|&amp;lt;math&amp;gt;\mathop\sigma(X+Y)=\sqrt{\mathop\sigma(X)^2+\mathop\sigma(Y)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
|{{Nowrap|If we know absolute error bars, then adding two precise numbers will}} at worst add the sizes of the two error bars. For example, if our precise numbers are 1 (±10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;) and 1 (±10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;), then our sum is 2 (±2·10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;). It is possible to lose a lot of relative precision, if the resultant sum is close to zero as a result of adding a number and then close to its inverse. This phenomenon is known as catastrophic cancellation. Therefore, it is likely that all numbers referred here are positive numbers, which does not exhibit this phenomenon.&lt;br /&gt;
|-&lt;br /&gt;
|Precise number × Precise number = Slightly less precise number&lt;br /&gt;
|&amp;lt;math&amp;gt;\mathop\sigma(X\times Y)=&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;\sqrt{\mathop\sigma(X)\times Y^2+\mathop\sigma(Y)\times X^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
|Here, instead of absolute error, relative error will be added. For example, if our precise numbers are 1 (±10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;) and 1 (±10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;), then our product is 1 (±2·10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
|Precise number + Garbage = Garbage&lt;br /&gt;
|&amp;lt;math&amp;gt;\mathop\sigma(X+Y)=\sqrt{\mathop\sigma(X)^2+\mathop\sigma(Y)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
|If one of the numbers has a high absolute error, and the numbers being added are of comparable size, then this error will be propagated to the sum. &lt;br /&gt;
|-&lt;br /&gt;
|Precise number × Garbage = Garbage&lt;br /&gt;
|&amp;lt;math&amp;gt;\mathop\sigma(X\times Y)=&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;\sqrt{\mathop\sigma(X)\times Y^2+\mathop\sigma(Y)\times X^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
|Likewise, if one of the numbers has a high relative error, then this error will be propagated to the product. Here, this is independent of the sizes of the numbers.&lt;br /&gt;
|-&lt;br /&gt;
|√&amp;lt;span style=&amp;quot;border-top:1px solid; padding:0 0.1em;&amp;quot;&amp;gt;Garbage&amp;lt;/span&amp;gt; = Less bad garbage&lt;br /&gt;
|&amp;lt;math&amp;gt;\mathop\sigma(\sqrt X)=\frac{\mathop\sigma(X)}{2\times\sqrt X} &amp;lt;/math&amp;gt;&lt;br /&gt;
| When the square root of a number is computed, its relative error will be halved. Depending on the application, this might not be all that much ''better'', but it's at least ''less bad''.&lt;br /&gt;
|-&lt;br /&gt;
|Garbage&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; = Worse garbage&lt;br /&gt;
|&amp;lt;math&amp;gt;\mathop\sigma(X^2)=2\times X\times\mathop\sigma(X)&amp;lt;/math&amp;gt;&lt;br /&gt;
|Likewise, when a number is squared, its relative error will be doubled. This is a corollary to multiplication adding relative errors.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;\frac{1}{N}\sum(&amp;lt;/math&amp;gt;N pieces of statistically independent garbage&amp;lt;math&amp;gt;)&amp;lt;/math&amp;gt; = Better garbage&lt;br /&gt;
|&amp;lt;math&amp;gt;{\sigma}_\bar{x}\ = \frac{\sigma_x}{\sqrt{N}}&amp;lt;/math&amp;gt;&lt;br /&gt;
|By aggregating many pieces of statistically independent observations (for instance, surveying many individuals), it is possible to reduce relative error to the {{w|Standard_error#Standard_error_of_the_mean|standard error of the mean}}. This is the basis of statistical sampling and the {{w|central limit theorem}}.&lt;br /&gt;
|-&lt;br /&gt;
|Precise number&amp;lt;sup&amp;gt;Garbage&amp;lt;/sup&amp;gt; = Much worse garbage&lt;br /&gt;
|&amp;lt;math&amp;gt;\mathop\sigma(b^X)=b^{2\times X}\times\mathop{\mathrm{ln}}b\times\sigma(X)&amp;lt;/math&amp;gt;&lt;br /&gt;
|The exponent is very sensitive to changes, which may also magnify the effect based on the magnitude of the precise number.&lt;br /&gt;
|-&lt;br /&gt;
|Garbage – Garbage = Much worse garbage&lt;br /&gt;
|&amp;lt;math&amp;gt;\mathop\sigma(X-Y)=\sqrt{\mathop\sigma(X)^2+\mathop\sigma(Y)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
|This line involves catastrophic cancellation. If both pieces of garbage are about the same (e.g. if their error bars overlap), then it is possible that the answer is positive, zero, or negative.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;\frac{\text{Precise number}}{\text{Garbage}-\text{Garbage}}&amp;lt;/math&amp;gt; = Much worse garbage, possible division by zero&lt;br /&gt;
|&amp;lt;math&amp;gt;\mathop\sigma(\frac{a}{X-Y})=&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;|\frac a{X-Y}|\times\sqrt{\mathop\sigma(X)^2+\mathop\sigma(Y)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
|Indeed, as with above, if error bars overlap then we might end up dividing by zero.&lt;br /&gt;
|-&lt;br /&gt;
|Garbage × 0 = Precise number&lt;br /&gt;
|&amp;lt;math&amp;gt;\mathop\sigma(0)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Multiplying anything by 0 results in 0, an extremely precise number in the sense that it has no error whatsoever since we supply the 0 ourselves. This is equivalent to discarding garbage data from a statistical analysis.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The title text refers to the computer science maxim of &amp;quot;garbage in, garbage out,&amp;quot; which states that when it comes to computer code, supplying incorrect initial data will produce incorrect results, even if the code itself accurately does what it is supposed to do. As we can see above, however, when plugging data into mathematical formulas, this can possibly magnify the error of our input data, though there are ways to reduce this error (such as aggregating data). Therefore, the quantity of garbage is not necessarily conserved.&lt;br /&gt;
&lt;br /&gt;
==Transcript==&lt;br /&gt;
&lt;br /&gt;
[A series of mathematical equations are written from top to bottom]&lt;br /&gt;
&lt;br /&gt;
Precise number + Precise number = Slightly less precise number&lt;br /&gt;
&lt;br /&gt;
Precise number × Precise number = Slightly less precise number&lt;br /&gt;
&lt;br /&gt;
Precise number + Garbage = Garbage&lt;br /&gt;
&lt;br /&gt;
Precise number × Garbage = Garbage&lt;br /&gt;
&lt;br /&gt;
√&amp;lt;span style=&amp;quot;border-top:1px solid; padding:0 0.1em;&amp;quot;&amp;gt;Garbage&amp;lt;/span&amp;gt; = Less bad garbage&lt;br /&gt;
&lt;br /&gt;
Garbage² = Worse garbage&lt;br /&gt;
&lt;br /&gt;
1/N Σ (N pieces of statistically independent garbage) = Better garbage&lt;br /&gt;
&lt;br /&gt;
(Precise number)&amp;lt;sup&amp;gt;Garbage&amp;lt;/sup&amp;gt; = Much worse garbage&lt;br /&gt;
&lt;br /&gt;
Garbage – Garbage = Much worse garbage&lt;br /&gt;
&lt;br /&gt;
Precise number / ( Garbage – Garbage ) = Much worse garbage, possible division by zero&lt;br /&gt;
&lt;br /&gt;
Garbage × 0 = Precise number&lt;br /&gt;
&lt;br /&gt;
{{comic discussion}}&lt;br /&gt;
[[Category:Math]]&lt;/div&gt;</summary>
		<author><name>HappyDog</name></author>	</entry>

	</feed>