Chapter 2, Building Abstractions with Data

Section - 2.1 - Introduction to Data Abstraction

Exercise 2.9

Lets consider the interval and with width and .


. Thus the width is:


. Thus the width is:

Clearly, width of addition and subtraction of intervals is a function of the width of individual intervals.

If the width of the result of an operation(+, -, *, or /) between two intervals is a function of the widths of individual intervals, then applying same operation(+, -, *, or /) on two different pairs of intervals such that both pairs have same widths, will result in intervals with equals widths.

Lets take two different intervals and with equal widths say .

Now consider another interval with width say such that .

Lets say width of interval is and width of is , where denotes the arithmetic operation i.e. +, -, *, or /.

If width is a function of individual intervals, then it must be the case that because width of pair and is same i.e. . Thus where is some function.

Lets take example for addition:

. Thus we have and .

. Thus width . Also, . Thus width .

Clearly in case of addition operation.

Lets see for multiplication:

. Thus width . Also, . Thus width .

Here . Hence width of the result of multiplication of two intervals is not a function of individual intervals.