# Solution to SICP Exercise 2.9 A solution to Exercise 2.9:

Some preliminary definitions:

```(upper-bound (make-interval a b)) = a  (lower-bound (make-interval a b)) = b ```

``` (width i) = (/ (- (upper-bound i) (lower-bound i)) 2)  ```

```(add i1 i2) = (make-interval (+ (upper-bound i1) (upper-bound i2)) (+ (lower-bound i1) (lower-bound i2)))  ```

Rearranging :

```(* 2 (width i)) = (- (upper-bound i) (lower-bound i)) (+ (* 2 (width i)) (lower-bound i)) = (upper-bound i)  ```

From :

```(width (add i1 i2)) = (/ (- (upper-bound (add i1 i2)) (lower-bound (add i1 i2))) 2) ```

Simplifying with ,  and :

```(width (add i1 i2)) = (/ (- (+ (upper-bound i1) (upper-bound i2)) (+ (lower-bound i1) (lower-bound i2))) 2) ```

Substituting in :

``` = (/ (- (+ (+ (* 2 (width i1)) (lower-bound i1)) (+ (* 2 (width i2)) (lower-bound i2))) (+ (lower-bound i1) (lower-bound i2))) 2)```

``` ```

``` = (/ (- (+ (* 2 (width i1)) (* 2 (width i2)) (lower-bound i1) (lower-bound i2)) (+ (lower-bound i1) (lower-bound i2))) 2) ```

All the (lower-bound x)s cancel out, leaving:

``` = (/ (+ (* 2 (width i1)) (* 2 (width i2))) 2) ```

So do the 2s:

`(width (add i1 i2)) = (+ (width i1) (width i2))`

Clearly the width of the sum is a function only of the width of the operands.