# Finding the orthogonal projection of a function onto a subspace.

Find the orthogonal projection of the function $f(x)=x$ onto the subspace of $C([-1,1])$ spanned by $\sin\pi$x , $\sin2\pi$x, $\sin3\pi$x .

I was given this problem and I don't really know how to go about solving it. I understand orthogonal projection with vectors and can use Gram-Schmidt but I'm a bit confused how to even begin with this sort of problem. Any help would be much appreciated.

Note that the inner product in $V=C([-1,1])$ is defined as $$\langle f,g\rangle=\int_{-1}^1f(x)g(x)\ dx\tag{1}$$ Now you have three vectors in $V$, $$v_1=\sin(\pi x), v_2=\sin(2\pi x), v_3=\sin(3\pi x).$$ And of course $f(x)=x$ is another vector in $V$. Denote it as $v=f$. Do you feel more familiar with this setting now and know how to go on?

Moreover, you don't need Gram-Schmidt here since $\{v_1,v_2,v_3\}$ is already an orthonormal set.

Exercise:

Calculate $\langle v,v_i\rangle$ for $i=1,2,3$ using (1). Then the projection is given by $$a_1v_1+a_2v_2+a_3v_3$$ where $a_i=\langle v,v_i\rangle$.

• OK I understand how to get the inner product of 2 functions but then is the projection of v onto $\left\{v_1, v_2, v_3\right\}$ just the vector with the 3 inner products as its entries? – B.K97 Jan 4 '17 at 22:48
• @B.K97: Please see the edited answer. – Jack Jan 4 '17 at 22:52
• OK I think I have it now thanks a lot – B.K97 Jan 4 '17 at 23:11
• I was just doing a similar question and was wondering if the subspace {$v_1$,$v_2$,$v_3$} is not orthonormal would you then need to use Gram-Schmidt to find an orthonormal basis for the subspace in order to find the orthogonal projection? – B.K97 Jan 12 '17 at 20:35
• @B.K97 Would you like to post a follow-up question? – Jack Jan 12 '17 at 22:36