and then prove that g is continuous on [a,b] and differentiable on (a,b) in order to apply the theorem.
Now, g is trivially continuous and differentiable on (a,b) since on this interval g=f and f is differentiable on (a,b). We thus need to prove that g is also continuous at x=a and x=b. For x=a, let ε>0. Because
y→a+limf(y)=la,
there exists by definition δ>0 such that
∀y,0<y−a<δ⟹∣f(y)−la∣<ε.
Since g(y)=f(y) for a<y<b (assuming δ<b−a) then the inequality holds for g(y). Moreover, g(a)=la. Thus,
∀y,0≤y−a<δ⟹∣g(y)−la∣<ε
and therefore
y→alimg(y)=g(a).
It can be proved similarly that
y→blimg(y)=g(b).
With these conditions satisfied, we can apply the mean value theorem which gives the equality