# Average value of a function

1. Aug 6, 2013

### reinloch

1. The problem statement, all variables and given/known data
Suppose we walk along a unit semicircle.

2. Relevant equations
Find the average value of our distance from the base of the semicircle.

3. The attempt at a solution
$y_{ave} = \frac{1}{1-(-1)}\int_{-1}^1\sqrt{1-x^2}\ dx = \frac{\pi}{4}$
OR
$y = \sin\theta, \qquad 0 \le \theta \le \pi$
$y_{ave} = \frac{1}{\pi-0}\int_0^{\pi}\sin\theta\ d\theta = \frac{2}{\pi}$

I would appreciate if anyone can enlighten me on why these approaches lead to different answers, and if any one of them is wrong. Thanks.

2. Aug 6, 2013

### SammyS

Staff Emeritus
Since the answers are different, they can't both be correct.

Do you expect a difference if you find the average while walking along the semi-circle versus walking along the x-axis ?

3. Aug 7, 2013

### LCKurtz

To add to Sammy's comments, in your equation$$\bar y = \frac 1 2\int_{-1}^1\sqrt{1-x^2}~dx$$try the substitution $x=\cos\theta$. That will express the integral correctly in terms of $\theta$, and if you are careful and do it correctly you will get the same $\frac \pi 4$ answer.

[Edit - added later:] I agree with Curious2141's later post. The correct answer is $\frac 2 \pi$.

Last edited: Aug 7, 2013
4. Aug 7, 2013

### Curious3141

The correct answer is $\frac{2}{\pi}$.

To determine the average value of a continuous function, you need to define the function properly in terms of a specified independent variable. It might be tempting to use the definition $y = \sqrt{1-x^2}$ here and compute the average like you did in the first attempt. But this would be wrong because it is implying that you are walking in order to keep $\frac{dx}{dt}$ constant. That's a rather weird way to walk.

A more natural walk would be to walk such that the average speed along the arc is kept constant. In other words, if we can find the traversed arc length as a function of x, we can then find y as a function of s, and then average y the usual way.

The y-axis is a line of symmetry, so it suffices to consider the positive x-axis (1st quadrant). If you start by working with $\displaystyle s = \int_0^x \sqrt{1 + (\frac{dy}{dx})^2}dx$ you will quickly end up with $s = \arcsin x \implies x = \sin s \implies y = \cos s$.

Now, if you average $y(s)$ over the first quadrant by evaluating $\frac{1}{\arcsin 1} \int_0^{\arcsin 1} \cos s ds$, you'll quickly find the average value $\overline{y(s)} = \frac{2}{\pi}$. Since the 2nd quadrant is simply a reflection of the 1st quadrant, the average is the same there, as is the overall average.

You'll note that this is basically identical to the value you obtained using the second method, and that in fact is correct as well. If you think about it, walking such that your bearing with respect to the origin changes at a constant rate is equivalent to walking at constant speed along the arc length of the semicircle because of the relationship $s = r\theta$.

(As an aside, $\frac{2}{\pi}$ also intuitively "looks" more correct because it is the same answer we get in Buffon's needle, but this is a little bit of handwaving, and not rigorous.)

EDIT: An even quicker (and nicer) way of working through the arc length approach:

$$\overline{y(s)} = \frac{1}{s}\int_0^s y ds = \frac{1}{s}\int_{-1}^{1} y\frac{ds}{dx}dx = \frac{1}{s}\int_{-1}^{1} y\sqrt{1 + (\frac{dy}{dx})^2}dx = \frac{1}{s}\int_{-1}^{1} 1dx = \frac{2}{\pi}$$

I used FTC and Chain Rule, and skipped a few steps in simplifying the algebra, but the result is quicker.

Last edited: Aug 7, 2013