# Finding a function that fits this description (Rolle's Theorem)

Context

In the previous question, we were asked to prove Rolle's Theorem: If f is continuous on (a,b) and f (a) = f (b) = 0 then f (c) = 0 for a certain c in (a,b).

Question

In the case of I = [0, 1], give an example of a function fitting the description of part (a), non-constant on any sub-interval of [0,1], such that f '(c) = 0 for infinitely many c in (0,1)

My first guess of a function that fit the description was f(x) = sin (1/x), but that doesn't work because it isn't defined on [0,1], not continuous, f(0) =/=0 and f(1) =/= 0

Any help would be appreciated. Thank you!

At least for $x \not = 0$, you know $-1 \le \sin\left(\frac1x\right) \le 1$, and that it is differentiable, and that it changes sign infinitely often in $(0,1)$

So find some non-constant differentiable function which is always non-negative on $[0,1]$ with $g(0)=g(1)=0$, such as $g(x)=x(1-x)$

Now multiply these together

So $$f(x)=x(1-x)\sin\left(\frac1x\right)$$ for $x \not = 0$. To deal with continuity, define $f(0)=\lim_{x\to 0} f(x) = 0$. This will now meet the conditions as it too is differentiable in $(0,1)$ and changes sign infitiely often.

It looks like this red curve, bounded by $\pm g(x)$ in grey

• Thank you! That makes sense and helps a lot May 6, 2018 at 23:07

Take $I$ and divide it in two subintervals of length $1/2$, take the fist of those subintervals and fit a parabola passing through the points $(0,0)$ and $(1/2,0)$. Now take the other subinterval of lenght $1/2$, divide it into two subintervals of lenght $1/4$, take the first of those and fit another parabola passing trough the pints $(1/2,0)$ and $(3/4,0)$. Iterate this procedure infinitely many times and you will get the desired function.

If you need an explicit formulae you can write it like this: $$f(x)=(x- \frac{1}{4})^2- \frac{1}{4} \quad \mbox{if} \ x\in [0,\frac{1}{2}]$$ $$f(x)=\Big[x-\Big(\sum_{i=1}^n \frac{1}{2^i}+\frac{1}{2^{n+2}}\Big)\Big]^2-\Big(\frac{1}{2^{n+2}}\Big)^2 \quad \mbox{if} \ x \in \Big[\sum_{i=1}^n \frac{1}{2^i},\sum_{i=1}^{n+1}\frac{1}{2^i}\Big] \quad \forall n \geq 1$$ $$f(x)=0 \quad \mbox{if} \ x=1$$