Let $Y$ be a subspace of the normed vector space $X$ and let $x\in X$. Define $$d(x,Y)=\inf\{\lVert x+y \rVert,y\in Y\}$$
Prove that $d(x,Y)=\sup\{|f(x)|:f\in X^*,\lVert f\rVert \leq 1, f|_Y=0\}$
I have proven that $d(x,Y)\geq \sup\{|f(x)|:f\in X^*,\lVert f\rVert \leq 1, f|_Y=0\}$. How to prove that the equality can be achieved?