Example for not having closest polynomial of $f$ in some infinite dimensional vector space I have a question about some subspace of $C[0,1]$ in my text book introducing.( $C[0,1]$ is all the rea-valued continuous function space on [0.1]). here is contents in my textbooks

Consider the subspace $S=\{h \in C[0,1] : h(0)=0\}$ and $T=\{h \in S : \int_{0}^{1}h(x) =0 \}$
Let $g(x)=x$ and consider the distance of $g$ to $T$. Note that $g(0)=0$ but
$$\int_{0}^{1}g(x)dx=\frac{1}{2}$$
suppose that $h\in T$, and compute that 
$$\frac{1}{2}=\int_{0}^{1}(g(x)-h(x))dx \le \int_{0}^{1}||g-h||_\infty dx =||g-h||_\infty$$
if $||g-h||_\infty=\frac{1}{2}$ then this inequality must be an equality. this can occur only if 
  *$$g(x)-h(x)=||g-h||_\infty=\frac{1}{2}$$*****
this implies that $h(x)=x-\frac{1}{2}.$ Note that $h$ does not lie in $T$ because $h(0)=0$ So the distance $\frac{1}{2}$ is not attained

I am curious about how to happen "$||g-h||_\infty = \frac{1}{2}$ $\Rightarrow$ $g(x)-h(x)=||g-h||_\infty=\frac{1}{2}$" on the above text.the converse is trivial, but origin proposition need to be proved. please give me a hint about proposition

Use the fact that if $\int^1_0 f(x)dx=0$ and $f\ge 0$ on $[0,1]$ then $f=0$ on $[0,1].$ Because if not then, continuity of $f$ implies that there is an interval $I\in [0,1]$ such that $f>0$ on $I$ and then $\int^1_0 f(x)dx\ge \int_I f(x)dx>0$ which is a contradiction. 
Now then, if $\int_{0}^{1}(g(x)-h(x))dx = \int_{0}^{1}||g-h||_\infty dx,$ then $\int_{0}^{1}(||g-h||_\infty-(g(x)-h(x))) dx=0$ and as $||g-h||_\infty-(g(x)-h(x))\ge 0$ this implies that $||g-h||_\infty-(g(x)-h(x))=0\Rightarrow ||g-h||_\infty=g(x)-h(x).$
