I found this statement on a functional analysis book and I am having trouble to show it.
Let $X,Y$ be Hilbert spaces with dot products $(\cdot,\cdot)_X$ and $(\cdot,\cdot)_Y$ . Let $f,g: X\to Y$ be functions (they must not necessarilly be linear or continuous). Then \begin{align*} f=g \iff \forall x\in X,y \in Y: (f(x),y)_Y=(g(x),y)_Y \end{align*} The $\Rightarrow$ direction is trivial. I tried to proof the other direction by contradiction but I did not find a solution.
If for all $y\in Y$ we have $$(f(x) , y ) =(g(x),y) $$ then by putting $y =f(x) -g(x) $ we get $$0 = (f(x) -g(x) , f(x) - g(x) )= ||f(x) - g(x) ||^2 $$ thus $f(x) =g(x) $ and since we can do it for any $x$ therefore $f=g.$