In fact, the condition of Rolle's theorem is that the connecting line of the function at the ends of A and B is parallel to the X axis.
The condition of Lagrange's theorem is to find a way to make it parallel to the straight line passing through (a, f(a)), (b, f(b)).
That is, a transformation is used to flatten both ends of the function.
The analytic formula of the line segment passing through (a, f(a)) and (b, f(b)) is y = (f(b)-f(a))/(b-a)*(x-a)+f(a).
Therefore, f (x)-y = f (x)-[(f (b)-f (a))/(b-a) * (x-a)+f (a)] satisfies the Rolle theorem condition on [a, b].
As for m and n, they can be completely ignored.