Does $P \circ P =P$ and $\langle Px, y \rangle = \langle x, Py \rangle$ imply $P$ is linear? 
Let $(H, \langle \cdot, \cdot \rangle)$ be a Hilbert space and $P:H \to H$. Suppose that
  
  
*
  
*$P \circ P =P$
  
*$\langle Px, y \rangle = \langle x, Py \rangle$ for all $(x,y) \in H^2.$
I would like to ask if $P$ is linear. 

I tried some functions such as absolute value, identity, and constant. But none of them satisfy the second condition.
Please don't give me the proof, in case this statement is correct. I would like to give it a shot by myself.
 A: The second condition alone is sufficient to get linearity.
Hint:

 The right-hand side is linear in $x$, hence the left-hand side is also linear in $x$.

A: In fact, you don't need $P \circ P=P.$
Hint: Show $$\langle P(ax_1+x_2),y\rangle=\langle aP(x_1)+P(x_2),y\rangle$$ for every $y \in H$ using the second condition.
A: After many days of intermittent thoughts, I have come up with my own proof.

*

*$P(\alpha x) = \alpha Px$ for all $(\alpha,x) \in \mathbb R \times H$
It suffices to show that $\langle P(\alpha x) - \alpha Px, y \rangle = 0$ for all $y \in H$. This is equivalent to $\langle P(\alpha x) , y \rangle = \langle \alpha Px, y \rangle = \alpha\langle  Px, y \rangle$. This is actually true because $\langle P(\alpha x) , y \rangle = \langle \alpha x , Py \rangle = \alpha \langle  x , Py \rangle = \alpha\langle  Px, y \rangle$.

*

*$P( x + y) =Px + Py$ for all $(x,y) \in H^2$
It suffices to show that $\langle P( x + y) - Px - Py,z \rangle = 0$ for all $z \in H$. This is equivalent to $\langle P( x + y), z  \rangle = \langle Px + Py,z \rangle$. This is actually true because $\langle P( x + y), z  \rangle = \langle x + y, P z  \rangle = \langle x, P z  \rangle + \langle y, P z  \rangle = \langle Px,  z  \rangle + \langle Py,  z  \rangle= \langle Px + Py,z \rangle$.
