Given $U$ vectorial space, find a linear functional such that $U=f^{-1}(\beta)$ I am stuck on the following problem:

Given a vector space $V$ with $\dim(V)=n$, an affine subspace $W$ with $\dim(W)=n-1$, $x\in V$ and $K\subset V$ compact and convex with $W\cap K = \{x\}$, find a linear functional $f:V\to\Bbb R$ such that $W=\{y\in V~|~f(y)= f(x) \}$, with $f(x)=\sup_{y\in K}f(y)$.

Any hint will be very helpful.
 A: Such a functional may not exist at all!! You would have to assume at least that $b\notin ri(K)$. Consider 
$$V= \mathbb{R}^2,\; U=\{(x,y)\in V: x=0\}.$$ Also, put $a=x=(0,0),\; b= (1,0)$ and 
$$K=[0,2]\times \{0\}.$$ Assume that a functional $f$ satisfying your conditions exist. So there exists $m,n\in \mathbb{R}$ such that 
$$f(x,y)=mx+ny.$$ Note that since $U$ is a subspace and the level set of a linear functional, it can only be $\beta=0.$ This means that $U$ is necesarily the Kernel of $f,$ and so we will have $n=0.$ Hence $f(x,y)=mx.$ We must also have 
$$f(x,y)\leq f(b)\;\forall\;(x,y)\in K,$$ which is equivalent to 
$$mx\leq f(b)=m \;\forall\; x\in [0,2],$$ a contradiction.
$\textbf{EDIT:}$ Since the question was edited, now I will show that this new statement is not true either. 
Choose $$V= \mathbb{R}^2,\; U=\{(x,y)\in V: x=0\}$$ and $K=[-1,1]\times\{0\}.$ Hence $x=(0,0).$ Assume that such a functional $f$ exists. Then necessarily $f(x)=0$ Then, if $f(y_1,y_2)=my_1+ny_2,$ we must have 
$$U=\{y \in V: f(y)=0\},$$ or $n=0.$ Then we should have
$$f(y)= my_1\leq 0=f(x)$$ for each $y_1\in [-1,1],$ a contradiction. 
