ArticleslgStudy

biology

Catastrophic cancellation

Catastrophic cancellation is a biology topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Catastrophic cancellation rather than just read about it. In short: In numerical analysis, catastrophic cancellation is the phenomenon that subtracting good approximations to two nearby numbers may yield a very bad approximation to the difference of the original numbers. For example, if a first object L1=253.51cm long and a second object L2=252.49cm long are measured with a ruler that is good only to the centimeter, then the approximations could come out to be L~1=254cm and L~2=252c…

Key takeaways

  • Catastrophic cancellation belongs to biology; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Catastrophic cancellation to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Catastrophic cancellation from memory before moving on to harder problems.

Reference excerpt

In numerical analysis, catastrophic cancellation is the phenomenon that subtracting good approximations to two nearby numbers may yield a very bad approximation to the difference of the original numbers. For example, if a first object L1=253.51cm long and a second object L2=252.49cm long are measured with a ruler that is good only to the centimeter, then the approximations could come out to be L~1=254cm and L~2=252cm. These may be good approximations, in relative error, to the true lengths: the approximations are in error by less than 0.2% of the true lengths, |L1−L~1|/|L1|<0.2%. However, if the approximate lengths are subtracted, the difference will be L~1−L~2=254cm−252cm=2cm, even though the true difference between the lengths is L1−L2=253.51cm−252.49cm=1.02cm. The difference of the approximations, 2cm, is in error by almost 100% of the magnitude of the difference of the true values, 1.02cm. Catastrophic cancellation is not affected by how large the inputs are—it applies just as much to large and small inputs. It depends only on how large the difference is, and on the error of the inputs. Exactly the same error would arise by subtracting 52cm from 54cm as approximations to 52.49cm and 53.51cm, or by subtracting 2.00052km from 2.00054km as approximations to 2.0005249km and 2.0005351km. Catastrophic cancellation may happen even if the difference is computed exactly, as in the example above—it is not a property of any particular kind of arithmetic like floating-point arithmetic; rather, it is inherent to subtraction, when the inputs are approximations themselves. Indeed, in floating-point arithmetic, when the inputs are close enough, the floating-point difference is computed exactly, by the Sterbenz lemma—there is no rounding error introduced by the floating-point subtraction operation.

Formal analysis Formally, catastrophic cancellation happens because subtraction is ill-conditioned at nearby inputs: even if approximations x~=x(1+δx) and y~=y(1+δy) have small relative errors |δx|=|x−x~|/|x| and |δy|=|y−y~|/|y| from true values x and y, respectively, the relative error of the difference x~−y~ of the approximations from the difference x−y of the true values is inversely proportional to the difference of the true values: x~−y~=x(1+δx)−y(1+δy)=x−y+xδx−yδy=x−y+(x−y)xδx−yδyx−y=(x−y)(1+xδx−yδyx−y). Thus, the relative error of the exact difference x~−y~ of the approximations from the difference x−y of the true values is |xδx−yδyx−y|. which can be arbitrarily large if the true values x and y are close.

In numerical algorithms Subtracting nearby numbers in floating-point arithmetic does not always cause catastrophic cancellation, or even any error—by the Sterbenz lemma, if the numbers are close enough the floating-point difference is exact. But cancellation may amplify errors in the inputs that arose from rounding in other floating-point arithmetic.

Example: Difference of squares Given numbers x and y, the naive attempt to compute the mathematical function x2−y2 by the floating-point arithmetic fl⁡(fl⁡(x2)−fl⁡(y2)) is subject to catastrophic cancellation when x and y are close in magnitude, because the subtraction can expose the rounding errors in the squaring. The alternative factoring (x+y)(x−y), evaluated by the floating-point arithmetic fl⁡(fl⁡(x+y)⋅fl⁡(x−y)), avoids catastrophic cancellation because it avoids introducing rounding error leading into the subtraction. For example, if x=1+2−29≈1.0000000018626451 and y=1+2−30≈1.0000000009313226, then the true value of the difference x2−y2 is 2−29⋅(1+2−30+2−31)≈1.8626451518330422×10−9. In IEEE 754 binary64 arithmetic, evaluating the alternative factoring (x+y)(x−y) gives the correct result exactly (with no rounding), but evaluating the naive expression x2−y2 gives the floating-point number 2−29=1.86264514923095703125_×10−9, of which less than half the digits are correct and the other (underlined) digits reflect the missing terms 2−59+2−60, lost due to rounding when calculating the intermediate squared values.

Example: Complex arcsine When computing the complex arcsine function, one may be tempted to use the logarithmic formula directly: arcsin⁡(z)=ilog⁡(1−z2−iz). However, suppose z=iy for y≪−1. Then 1−z2≈−y and iz=−y; call the difference between them ε—a very small difference, nearly zero. If 1−z2 is evaluated in floating-point arithmetic giving fl⁡(fl⁡(1−fl⁡(z2)))=1−z2(1+δ) with any error δ≠0, where fl⁡(⋯) denotes floating-point rounding, then computing the difference 1−z2(1+δ)−iz of two nearby numbers, both very close to −y, may amplify the error δ in one input by a factor of 1/ε—a very large factor because ε was nearly zero. This may make the final error very large even if the error δ in computing 1−z2 is very small. For instance, let z=−1234567i. The true value of arcsin⁡(z) is approximately −14.71937803983977i. But using the naive logarithmic formula in IEEE 754 binary64 arithmetic—which computes 1−z2 exactly, and incurs only a single rounding error of |δ|<2−53 in 1−z2—may give the floating-point number nearest to −14.719644263563968_i, with only five out of sixteen digits correct and the remainder (underlined) all incorrect. In the above case of z=iy for y≪−1, using the identity arcsin⁡(z)=−arcsin⁡(−z) avoids cancellation because 1−(−z)2=1−z2≈−y but i(−z)=−iz=y, so the subtraction is effectively addition with the same sign which does not cancel.

Example: Radix conversion Numerical constants in software programs are often written in decimal, such as in the C fragment double x = 1.000000000000001; to declare and initialize an IEEE 754 binary64 variable named x. However, 1.000000000000001 is not a binary64 floating-point number; the nearest one, which x will be initialized to in this fragment, is 1.0000000000000011102230246251565404236316680908203125=1+5⋅2−52. Although the radix conversion from decimal floating-point to binary floating-point only incurs a small relative error, catastrophic cancellation may amplify it into a much larger one:

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Catastrophic cancellation

Start with the simplest possible case. Write down what Catastrophic cancellation claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In biology, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Catastrophic cancellation before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Catastrophic cancellation ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Catastrophic cancellation

In research
Catastrophic cancellation appears in biology research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Catastrophic cancellation in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Catastrophic cancellation is common in secondary-school and first-year university syllabi. It links to neighbouring topics Numerical analysis, so understanding it makes those chapters shorter.
In everyday life
Look for Catastrophic cancellation outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Catastrophic cancellation” →

How to study Catastrophic cancellation in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Catastrophic cancellation means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Catastrophic cancellation out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Catastrophic cancellation in simple terms?

In numerical analysis, catastrophic cancellation is the phenomenon that subtracting good approximations to two nearby numbers may yield a very bad approximation to the difference of the original numbers. For example, if a first object L1=253.51cm long and a second object L2=252.49cm long are measur…

Why does Catastrophic cancellation matter?

Because it connects several biology ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Catastrophic cancellation?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Catastrophic cancellation.

Tags

  • Numerical analysis

Keep exploring