Why $\{u\in H^1(\Omega )\mid u|_{\partial \Omega }=g\}$ a hilbert space?

Let $\Omega$ open, smooth and bounded. Why $$K=\{u\in H^1(\Omega )\mid u|_{\partial \Omega }=g\}$$ is a hilbert space ? I recall that $H^1(\Omega )=W^{1,2}(\Omega )$.

Indeed, it's even not stable for the addition. Let $u,v\in K$, then $$(u+v)|_{\partial \Omega }=u|_{\partial \Omega }+v|_{\partial \Omega }=g+g=2g.$$ What's the problem here ?

Edit

Let $g\in H^{1/2}(\partial \Omega )$ and $f\in L^2(\Omega )$. Prove that there is a unique weak solution of $$\begin{cases} -\Delta u-u=f&\Omega \\ u=g&\partial \Omega \end{cases}.$$

The solution goes like :

We have to solve it in $$H=\{u\in H^1(\Omega )\mid u|_{\partial \Omega }=g\}.$$

The variational equation is given by $$\int_\Omega \nabla \varphi\cdot \nabla u-\int_\Omega u\varphi=\int_{\partial \Omega }g\varphi+\int f\varphi,\quad \varphi\in H.$$

We set $$a(u,\varphi)=\int_\Omega \nabla \varphi\cdot \nabla u-\int_\Omega u\varphi,$$ and $$T(\varphi)=\int_{\partial \Omega }g\varphi+\int f\varphi.$$ It's easy to prove that $a$ is continuous and coercive and $T$ is continuous. Lax-Milgram allow us to conclude.

Question : Since $H$ it's not a Hilbert space, the argument is wrong ? But it's an official solution of my course, so it should be a correct argument. By the way I also see this argument here (page 51-52 for people who read french). So I guess this argument is true... So how can it be true since $H$ is even not an Hilbert space ?

• It is not a Hilbert space - $H_0^1(\Omega)$ is a Hilbert space. – Yiorgos S. Smyrlis Jun 17 '17 at 16:22
• @YiorgosS.Smyrlis: So why to solve $$\begin{cases} \Delta u+u=f&\Omega \\ u=g&\partial \Omega \end{cases}$$ we can use Lax-Milgram in $\{u\in H^1\mid u|_{\partial \Omega }=g\}$ ? – MathBeginner Jun 17 '17 at 16:34

$K$ is infact not a hilbert space.Actually you do not use lax milagram directly for this problem. First you have to convert this to an equivalent homogeneous problem in $H_0^1$ and then you use lax milgram. This can be done by substracting off a function in $H^1$ with a trace equal to g. This is always possible due to trace theorem.
The argument of your teacher is wrong ! To use Lax-Milgram, you must be in a Hilbert space ! The link you put solve the problem in $H_0^1(\Omega )$. They do as following : Since the trace is surjective, there is $v\in H^1$ s.t. $v|_{\partial \Omega }=g$. Let $w=u-v$. Then your system is equivalent to $$(S):\begin{cases}\Delta w-w=f-\Delta v-v&\Omega \\ w=0&\partial \Omega .\end{cases}$$
You can apply your reasoning $(S)$ and you'll have what you want.