[archives] [homepage]

Problem 2.9
Friday, August 23, 2019; ago; Download .md

SICP Exercise 2.9

We know:

\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]

The add-interval procedure adds the lower-bound and upper-bound of both the intervals passed to it. Let the two intervals be (x) and (y):

$$ width (x) = \frac{U_x - L_x}{2} \ width (y) = \frac{U_y - L_y}{2} $$

Running:

(add-interval x y)

Let’s call this new interval sum. The width is:

$$ width (sum) = \frac{U_s - L_s}{2} $$

Where:

$$ U_s = U_x + U_y \ L_s = L_x + L_y $$

Substituting:

$$ \begin{align} width (sum) &= \frac{(U_x + U_y) - (L_x + L_y)}{2} \ width (sum) &= \frac{(U_x - L_x) + (U_y - L_y)}{2} \ width (sum) &= \frac{U_x - L_x}{2} + \frac{U_y - L_y}{2} \ width (sum) &= width (x) + width (y) \end{align} $$

Therefore, thhe width of sum or difference of two intervals is the function pnly of the widths of the intervals being added or subtracted.