adjoint operator 2 I am trying to answer the following question:
Let $A, B$ be two linear, closed, densely defined operators in a Hilbert space $H$ such that $D(A)=D(B)=D$ and $(Ax,y)=(x,By)$ for every $x,y\in D$. Can we infer that $B=A^*$?
To show $A^*=B$, I only need to prove that $D(A^*)\subset D$. But I can neither prove this or find a counterexample. 
Help me, please. Many thanks!
 A: Let $f(x) = (Ax,y)$ and let $g(x) = (x,By)$, then clearly $f$ and $g$ are continuous. We assumed that $f(x)=g(x)$ for all $x\in \mathcal{D}$ and by the following 
$f,g$ continuous from $X$ to $Y$. if they are agree on a dense set $A$ of $X$ then they agree on $X$
we conclude $f=g$ for all $x\in \mathcal{H}$ so we are finished.
A: Let $A$ be a closed densely-defined symmetric linear operator on a Hilbert space $H$ that is not selfadjoint. Let $B=A$. Then $(Ax,y)=(x,By)$ for all $x,y\in\mathcal{D}(A)=\mathcal{D}(B)$ because $A$ is symmetric. However, $A^{\star} \ne B$ because $A^*\ne A$, as $A$ is not selfadjoint.
Example: Let $H=L^2[0,1]$. Let $A=\frac{1}{i}\frac{d}{dx}$ on the domain consisting of $f \in L^2[0,1]$ that is equal a.e. to an absolutely continuous function $f_a$ on $[0,1]$ for which $f_a'\in L^2$, and such that $f_a(0)=f_a(1)=0$. Let $B=A$. Then $A$ is closed and densely-defined, with
$$
         (Af,g)-(f,Bg) = \frac{1}{i}\int_{0}^{1}f'\overline{g}+f\overline{g}'dt=0,\;\;\; f,g\in\mathcal{D}(A)=\mathcal{D}(B).
$$
However, $B \ne A^*$ because the constant function $1$ is in the domain of $A^*$ but not in the domain of $B$, as seen from
\begin{align}
          (Af,1) & = \frac{1}{i}\int_{0}^{1}f'dt = \frac{1}{i}[f_a(1)-f_a(0)]=0\\
       & \implies (Af,1)=(f,0),\;\; f\in\mathcal{D}(A) \\
       & \implies 1\in\mathcal{D}(A^*) \mbox{ and } A^*1 = 0.
\end{align}
