I'm familiar with the following characterization of best approximation in a Hilbert space but I'm not sure if it's true for a general inner product space. I want to check if the following claim is true:
Let $V$ be an inner product space and let $W$ be subspace of $V$.
Let $x\in V$. Then $x_0\in W$ is a best approximate for $x$ in $W$ iff $x-x_0\perp W$.
$x_0\in W$ is a best approximate for $x$ in $W$ if it minimizes $\|x-w\|$ among all $w\in W$.
I managed to prove that if $x_0\in W$ holds $x-x_0\perp W$, then it is a best approximate for $x$ in $W$.
but I couldn't prove the other direction. Is it true in this general setting (without requiring $W$ to be a Hilbert space or finite dimensional)? and if it is, can you provide me a hint of how to proceed with the other direction?
Because squaring is an increasing function on $\Bbb R_+, \|x - w\|$ is minimized exactly when $\|x - w\|^2$ is. But $\|x - w\|^2 = \langle x - w, x - w\rangle$.
Writing $w = x_0 + w_0$, where $w_0$, we get
$$\langle x - w, x - w\rangle = \langle x - x_0 - w_0, x - x_0 - w_0\rangle = \|x - x_0\|^2 + \|w_0\|^2 - 2\langle x - x_0, w_0\rangle$$
Suppose $\langle x - x_0, w_0\rangle \ne 0$. Then the same is true if we replace $w_0$ with $aw_0$ for any real $a \ne 0$. In particular, we can choose $w_0$ with $\langle x - x_0, w_0\rangle > 0$ by choosing $a = -1$ if needed.
Now let $0 < a < 2\frac {\langle x - x_0, w_0\rangle}{\|w_0\|^2}$ and we see that $x_0 + aw_0$ satisfies $$\begin{align}\|x - (x_0 + aw_0)\|^2 &= \|x - x_0\|^2 + a^2\|w_0\|^2 - 2a\langle x - x_0, w_0\rangle\\&=\|x - x_0\|^2 +a\left(a\|w_0\|^2-2\langle x - x_0, w_0\rangle\right)\\&< \|x - x_0\|^2 + a\left(2\langle x - x_0, w_0\rangle - 2\langle x - x_0, w_0\rangle\right)\\&=\|x - x_0\|^2\end{align}$$
contradicting that $w = x_0$ minimizes $\|x - w\|^2$ for $w \in W$.