Let $f(x)$ be continuous for $x \in [a, b]$. Prove that: $$ \inf_{(a,b)}f = \inf_{[a,b]}f \\ \sup_{(a,b)}f = \sup_{[a,b]}f $$
I need some help with proving the statement above.
I've started with the case for infimum. Since $(a, b)\subset [a, b]$ then: $$ \inf_{x\in[a,b]}f(x) \le \inf_{x\in(a,b)}f(x) $$
By initial conditions $f(x)$ is continuous on $[a, b]$, hence by Bolzano-Weierstrass there exists $x_0$ such that: $$ f(x_0) = \inf_{x\in[a,b]}f(x) $$
There are three possible scenarios: $$ x_0 \in (a, b)\\ x_0 = a\\ x_0 = b $$
Suppose $x_0 \in (a, b)$, then exists a sequence $(x_n)_{n\in\Bbb N}$ such that: $$ \lim_{n\to\infty} x_n = x_0 $$
Then: $$ \inf_{x\in(a,b)}f(x) \le f(x_n) $$
Upon taking a limit we obtain: $$ \inf_{x\in(a,b)}f(x) \le \lim_{n\to\infty} f(x_n) = f(x_0) = \inf_{x\in[a,b]}f(x) $$
So: $$ \inf_{x\in[a,b]}f(x) \le \inf_{x\in(a,b)}f(x) \le \inf_{x\in[a,b]}f(x) \iff \inf_{x\in[a,b]}f(x) = \inf_{x\in(a,b)}f(x) $$
But there are still two "dangerous" scenarios when the function reaches its infimum at one of the ends of the closed interval. A proof by contradiction might be applicable somehow, yet I'm not sure it's true and how to proceed.
First of all note that $\inf_{[a,b]}f$ is a lower bound of $f((a,b))$ and hence $\inf_{[a,b]}f\leq\inf_{(a,b)}f$.
Now we want to prove the other direction. We will show that $\inf_{(a,b)}f$ is a lower bound of $f([a,b])$. Obviously for all $x\in (a,b)$ we have $\inf_{(a,b)}f\leq f(x)$. So our only problem can be at the boundary points. Suppose $f(a)<\inf_{(a,b)}f$. Then there is $\epsilon>0$ for which $f(a)+\epsilon<\inf_{(a,b)}f$. But by continuity we know that there is $\delta>0$ such that for all $x\in [a,a+\delta)$ we have $f(x)<f(a)+\epsilon$. But that way we get there is a point $x\in (a,b)$ such that $f(x)<\inf_{(a,b)}f$ and this is a contradiction. So $\inf_{(a,b)}f\leq f(a)$ and at the same way we can prove that $\inf_{(a,b)}f\leq f(b)$. Hence $\inf_{(a,b)}f$ is a lower bound of $f([a,b])$.