$Y$ is a proper closed subspace and $||f_0|| = 1$ and $d(f_0, Y ) = 1$. 
Let 
  $$
X = \{f \in C[0,1] : f(0) = 0\},\quad Y = \{f \in X : \int_0^1 f(t)dt = 0\}.$$ Prove that $Y$ is a proper closed subspace and $ \|f_0\|= 1$ and $d(f_0, Y ) = 1$.

I am getting a feeling to use Riesz Lemma, but unable to proceed. Need some hints.
 A: The closedness of $Y$ is simple. If $\{f_n\}\subset Y$ and $f_n\to f$ in $X$, then $\int_0^1 f(t)dt
=\lim_{n\to\infty} \int_0^1 f_n(t)dt=0$. Also, we can show the closedness of $Y$ by observing that $F(u)=\int_0^1 u(t)dt$ is a continuous linear functional and $Y=Ker{F}$, because the null space of every continuous functional is closed. 
For the second problem, I guess you want us to find $f_0\in X$ such that $\|f\|=d(f_0,Y)=1$. Correct me if I'm wrong. 
But, such function doesn't exist. We can recall  the following result, which can be found in page 24 of  H. Brezis's "Functional analysis, Sobolev spaces and PDEs". It can be proved by Hahn-Banach Theorem.   

Let $u\in X$ . Then it holds that $d(u,Y)=|\int_0^1 u(t) dt|$.  

In view of this result, we know that if $f_0$ exits, then it has to satisfy 
$$
|\int_0^1 f_0(t)dx|=1=\|f_0\|.
$$
The only continuous function satisfies the property above is $f\equiv\pm 1$, which is not in $X$, because $f_0(0)\neq 0$
PS:

Let us consider a general linear approximation problem $\inf_{u\in M}\|u-b\|$, where $M$ is a subspace of a Banach space $X$, and $b\in X$. Then we have
  $$
\inf_{u\in M}\|u-b\|=\sup_{\|f\|\leq 1,\,\, f\in M^0}|\langle f, b\rangle|,
$$ 
  where $M^0:=\{f\in X', f(x)=0 \,\forall\,x\in M\}$. The right-hand side of the equation is called "the dual problem " of the original approximation problem. The result above is only a special case of this general result. 

A: I'm assuming you are working with $\|\cdot\|_\infty$.
Define $\phi : X \to X$ as $\phi(f) = \int_0^1 f(x)\,dx$. $\phi$ is obviously linear, and it is also bounded:
$$|\phi(f)| = \left|\int_0^1 f(x)\,dx\right| \le \int_0^1 |f(x)|\,dx \le \int_0^1 \|f\|_\infty\,dx = \|f\|_\infty$$
Thus, $\phi$ is continuous and $Y = \phi^{-1}(\{0\})$ is closed as a preimage of a closed set under a continuous function.
Now I'm assuming you wish to find $f_0 \in X$ such that $\|f_0\|_\infty = 1$ and $d(f_0, Y) = 1$.
Note: The following is not correct since $1 \notin X$
Take $f_0 \equiv 1$. We obviously have $\|f_0\|_\infty = 1$ and since $d(f_0,0) = 1$, we get $d(f_0, Y)\le 1$.
To show that $d(f_0, Y)\ge 1$ assume there exists $f \in X$ such that $\|f - f_0\|_\infty < 1$. This would mean that there exists $x_0 \in [0,1]$ such that $f(x) > 0$. Since $f$ is continuous, there exists an interval $I \subseteq [0,1]$ containing $x_0$ such that $f|_I > 0$.
We have:
$$0 = \int_0^1 f(x)\,dx =\underbrace{\int\limits_I f(x)\,dx}_{>0} + \int\limits_{[0,1]\setminus I} f(x)\,dx$$
Therefore, $f$ has to be negative at some $x_1 \in [0,1]\setminus I$ which implies $\|f - f_0\|_\infty > 1$, which is a contradiction. Such a function $f$ cannot exist, so $d(f_0, Y) \ge 1$.
Thus, $d(f_0, Y) = 1$.
