Artificial intelligent assistant

Showing that $\sup f(x)^{2} = (\sup|f(x)|)^2$ for $x \in [x_{i-1}, x_i]$ I can sort of see why this result is correct, but I'm not sure how to prove it. I thought about shoeing one side is less than or equal to the other and the other side greater than or equal to the other, but I didn't get far with that.

$|f(x)|\leq\sup|f(x)|$, so $f(x)^{2}\leq(\sup|f(x)|)^{2}$, hence $\sup f(x)^{2}\leq(\sup|f(x)|)^{2}$.

For $\epsilon>0$, then $\sup|f(x)|-\epsilon<|f(x)|$ for some $x$, then $\sup|f(x)|<|f(x)|+\epsilon$, hence $(\sup|f(x)|)^{2}\leq(|f(x)|+\epsilon)^{2}=f(x)^{2}+2\epsilon |f(x)|+\epsilon^{2}\leq\sup f(x)^{2}+2\epsilon M+\epsilon^{2}$, where $M=\max\\{|x_{i-1}|,|x_{i}|\\}$. Since this is true for all $\epsilon>0$, we have $(\sup|f(x)|)^{2}\leq\sup f(x)^{2}$.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 7f6155454479351bdb2c34002b81b3eb