# Show orthogonal projection is minimal distance

In a textbook exercise a bunch of vector spaces were given along with subspaces and a vector $v$. Then the task was to compute the orthogonal projection $\pi(v)$ to that subspace $U$ with their respective scalar products. Simple enough,

now the task after that that asked: Compute the distance $$d(v,U):=min_{u\in U} ||v-u||$$ for all the spaces given in the previous task. Well it's the orthogonal projection we computed above! But how can one prove this? Especially when you move to more abstract spaces like the space of continuous functions, it does not seem that obvious anymore.

So how can we prove it? Maybe we can show $||v-\pi(v)||^2=\gamma(v-\pi(v),v-\pi(v))$ is minimal ( where $\gamma$ is the inner product). I don't know how you would approach showing it is the minimal distance. Finding a minimum seems more like a calculus problem!

Related questions often state that this is the case, but do not show a proof, see for example : Projection of v onto orthogonal subspaces are the those with minmum distance to v?

• The usual way to prove this is via the triangle inequality for norms (generalization of the Pythagorean theorem), which itself is a consequence of the Cauchy-Schwarz inequality when the norm comes from an inner product. – amd May 31 '17 at 19:43

Using Pythagoras theorem, one has: $$\|v-u\|^2=\|v-\pi(v)\|^2+\|u-\pi(v)\|^2\geqslant\|v-\pi(v)\|^2.$$ Indeed, $u-\pi(v)\in U$, since $U$ is a vector space and $v-\pi(v)\in U^{\perp}$, for the last point notice that: $$\pi(v-\pi(v))=0,$$ since $\pi$ is a linear projection, so that $v-\pi(v)\in\ker(\pi)=U^{\perp}$. Whence the result.
Let $V=L^2(\mathbb{T})$ the vector space of square-integrable $1$-periodic functions and $U$ its subvector space formed by the trigonometric polynomials of degree at most $n$. In this setup, the result of your exercise means that the $n$-th partial sum of the Fourier series of $f$ is the best $L^2$-estimate of $f$ as a trigonometric polynomial of degree at most $n$.