# Graphs with two intervals

1. Jan 24, 2010

### Dollydaggerxo

In general,
if f(x)=k but only for a < x < b and c < x < d
how would you integrate the graph ?
To find the mean for example, would you find the mean for each and add together, or is there some special thing for this case?

2. Jan 24, 2010

### Staff: Mentor

What's the value of f(x) for x not in the two intervals? Presumably the value is zero, but you didn't state this.

Assuming for the moment that f(x) = 0 outside the two intervals, finding the integral of this function (not the integral of its graph) is easy to find.
$$\int_{-\infty}^{\infty} f(x) dx~=~\int_a^b f(x) dx~+~\int_c^d f(x) dx~=~k(b - a)+ k(d - c)$$

To find the mean value of this function over the two intervals, evaluate the integral of the function (see above), and then divide by the length of the two intervals, b - a + d - c.

3. Jan 24, 2010

### Dollydaggerxo

sorry, yes I meant if it is zero everywhere else.
Thanks