Give the formula of the $1$st degree Lagrange polynomial $L(x)$ interpolating a function $f$ at the points $0$ and $1$. Give the formula for the error $L - f$. Finally, show that
$$\sup_{x \in [0, 1]} |L(x) - f(x)| \leq \frac{1}{8} \sup_{[0, 1]} |f''|. $$
To do this problem, I used the formula
$$L(x) = \sum_{i=0}^{n} l_{i}(x) y_{i},$$
where $$l_{i}(x) = \prod_{0 \leq j \leq n \text{ and } j \neq i} \frac{x - x_{j}}{x_{i} - x_{j}}$$
with $x_{0} = 0, x_{1} = 1$ and $y_{0} = f(x_{0}), y_{1} = f(x_{1})$.
So first,
$$l_{0}(x) = \frac{x - x_{1}}{x_{0} - x_{1}} = \frac{x - 1}{-1} = 1 - x. $$
Also,
$$\ell_{1}(x) = \frac{x - x_{0}}{x_{1} - x_{0}} = x .$$
So I got $L(x) = (1 - x)y_{0} + xy_{1}$ as my answer. Is this correct? I'm new to Lagrange interpolation and just wanna make I'm doing everything right.
Assuming this is right, I have the error formula provided in my book:
$$|L(x) - f(x)| \leq \frac{M_{n + 1}}{(n + 1)!} |\pi_{n + 1}(x)|,$$
where $M_{n + 1} = \max_{\xi \in [a, b]} |f^{(n + 1)}(\xi)|$ and $\pi_{n + 1}(x) = \prod_{i=0}^{n} (x-x_{i})$.
This looks really similar to what I need to do next, but I would like some guidance on how to do the next two parts.
First part looks good. For the second part, notice that $|\pi_{n+1}(x)| = |x(x-1)|\leq \frac14$ for $x\in \lbrack 0,1\rbrack$. Prove this using calculus techniques. The answer should follow.