I am reading this nice book on linear algebra. Specifically, I am reading the proof of the Theorem for Orthogonal decomposition of a vector $x\in \mathbb{R}^n$, given a subspace $W$. I think there is a step missing on the proof of its uniqueness.
Theorem: Let $W$ be a subspace of $\mathbb{R}^{n}$ and let $x$ be a vector in $\mathbb{R}^{n}$. Then we can write $x$ uniquely as $$x = x_W + x_{W^\perp}$$ where $x_W$ is the closest vector to $x$ on $W$ and $x_{W^\perp}$ is in $W^\perp$.
If I am not wrong, the proof for uniqueness is commonly carried out usually by absurd, i.e. assuming that the decomposition is not unique and deriving a contradiction.
Proof:
We assume that $$x = x_W + x_{W^\perp}=y_W + y_{W^\perp}$$
Rearranging gives:
$$x_W - y_W - y_{W^\perp} - x_{W^\perp} $$
This is the passage I don't fully understand:
Since $W$ and $W^\perp$ are subspaces, the left side of the equation is in $W$ and the right side is in $W^\perp$. Therefore, $x_W - y_W$ is in $W$ and $W^\perp$, so it's orthogonal to itself.
I don't understand why there is a "therefore" there, and why we can say that $x_W - y_W$ is in $W^\perp$ as a linear combination of vectors in $W$ should stay in $W$, and not in $W^\perp$.
Rearranging you get that$$x_W-y_W=y_{W^\perp}-x_{W^\perp}.\tag1$$So, since $x_W-y_W\in W$, $y_{W^\perp}-x_{W^\perp}\in W$, too. But $y_{W^\perp}-x_{W^\perp}\in W^\perp$. So, $y_{W^\perp}-x_{W^\perp}=0$, and it follows from $(1)$ that $x_W-y_W=0$ too. So, $x_W=y_W$, and $x_{W^\perp}=y_{W^\perp}$.