**mean value theorem**from math real analysis.

This led me to the idea to generate some drawing which nicely illustrates the idea of the proof. Let's first restate the

**mean value theorem**.**Theorem:**If the function $f$ is defined and continuous in the closed interval $[a,b]$ and is differentiable in the open interval $(a,b)$, then there exists a point $\theta$ which is strictly between $a$ and $b$ i.e. $a \lt \theta \lt b$, such that

$$f'(\theta) = \frac{f(b)-f(a)}{b-a} \tag{1}$$

The proof constructs a function and I was wondering what the idea is behind that function. So I finally understood that and wanted to illustrate it here via some nice drawing. It took me some time to find a good looking function but OK... I finally picked this one:

$$f(x) = \sin(t) - \sin^2(t/2) + \cos^3(t/5) \tag{2}$$

Here is the drawing I generated.

The given function $f(x)$ is shown in red in the figure above.

The proof of the theorem is quite nice. Main role in it plays the the line which connects the two endpoints of the graph of $f(x)$ i.e. the points $(a,f(a))$ and $(b,f(b))$. This line is represented by the function

$$g(x) = f(a) + \frac{f(b)-f(a)}{b-a}(x-a) \tag{3}$$

The line is shown in green in the figure above.

The proof then goes on to construct the function $h(x) = f(x)-g(x)$ and for this one it can be easily seen that $h(a)=h(b)=0$. The proof then applies

**Rolle's theorem**to the function $h$ to get the desired result.So I was wondering how this function $h(x) $looks like. It is shown in deep sky blue in the figure above. The interesting thing about this function $h(x)$ is that it measures (at each point $x$) what the difference is between $f(x)$ and $g(x)$.

In simple words this can be formulated in 2 different ways:

a) At any value of $x$ the point $(x,h(x))$ is

**as far from**the X axis,**as**$(x,f(x))$**is from**$(x,g(x))$.This follows from the fact that: $h(x) = f(x) - g(x)$ which can be informally stated as

*blue = red - green*.b) At any value of $x$ the point $(x,f(x))$ is

**as far from**$(x,h(x))$,**as**$(x,g(x))$**is from**the X axis.This follows from the fact that: $f(x) - h(x) = g(x)$ which can be informally stated as

*red**-**blue = green*.