Orthogonal Projection on a Polynomial Space

An inner product is defined on $$P3$$ such that $$$$ $$=$$ $$\int _{-1}^1\:f\left(t\right)g\left(t\right)dt$$.

What is the orthogonal projection of $$p(x)$$ $$=$$ $$x^3$$ onto $$P2$$?

So I got that $$f_1\left(x\right)=1,\:f_2\left(x\right)\:=\:x,\:f_3\left(x\right)\:=\:x^2$$ form a basis of $$P2$$. I also got that $$g_1\left(x\right)=f_1\left(x\right)=1$$, $$g_2\left(x\right)=f_2-\frac{}{}g_1$$ and $$g_3\left(x\right)=f_3-\frac{}{}g_1-\frac{}{}g_2$$.

From this, I got that, $$g_2\left(x\right)=x$$ and $$g_3\left(x\right)=x^2-\frac{1}{3}$$.

I know that an orthonormal basis of $$P2$$ will have the form $$\left\{\frac{g_1}{\left|g_1\right|},\:\frac{g_2}{\left|g_2\right|},\:\frac{g_3}{\left|g_3\right|}\right\}$$, but I am quite confused on how to proceed further from this. I am not entirely sure how I would compute the norm and projection of the polynomials I have found and how I would proceed from this basis to find the required projection.

So if anyone can tell me if what I have done so far is correct or not, and how exactly I should proceed, I would greatly appreciate it!

The process looks good so far, as $$g_1,g_2,$$ and $$g_3$$ form an orthogonal basis on $$P_2$$. If you'd like an orthonormal basis, then these functions must be normalized. This means that we take

$$g_1(x)=\frac{1}{\sqrt 2},\;\;\;\;g_2(x)=\sqrt{\frac{3}{2}}x,\;\;\;\;g_3(x)=\sqrt{\frac{5}{2}}\frac{3x^2-1}{2}$$

The projection of a function $$f$$ onto this space is a function of the form $$h=a_1g_1+a_2g_2+a_3g_3$$ that minimizes the squared error between the two functions. We then seek to minimize

$$\langle f-h,f-h\rangle=\int_{-1}^1\left(f(x)-h(x)\right)^2dx$$

The mutual orthogonality makes this easy to compute (and I will leave it to you to check this), and we get

$$\langle f-h,f-h\rangle=\int_{-1}^1f(x)^2dx-2a_1\int_{-1}^1f(x)g_1(x)dx-2a_2\int_{-1}^1f(x)g_2(x)dx-2\int_{-1}^1f(x)g_3(x)dx$$

$$+a_1^2+a_2^2+a_3^2$$

In each term with an $$a_i$$, we complete the square to get

$$\langle f-h,f-h\rangle=\int_{-1}^1f(x)^2dx+\left(a_1-\int_{-1}^1f(x)g_1(x)dx\right)^2+\left(a_2-\int_{-1}^1f(x)g_2(x)dx\right)^2+\left(a_3-\int_{-1}^1f(x)g_3(x)dx\right)^2-\left(\int_{-1}^1f(x)g_1(x)dx\right)^2-\left(\int_{-1}^1f(x)g_2(x)dx\right)^2-\left(\int_{-1}^1f(x)g_3(x)dx\right)^2$$

This inner product is minimized when we take the quadratic terms with the $$a_i$$ to be $$0$$, since they are the sum of squares and are minimized when they are $$0$$. We then have

$$a_i=\int_{-1}^1f(x)g_i(x)dx=\langle f,g_i\rangle$$

for $$i=1,2,3$$. Thus, your projection of $$f$$ onto $$P_2$$ is

$$f\approx\langle f,g_1\rangle g_1+\langle f,g_2\rangle g_2+\langle f,g_3\rangle g_3$$

Sidenote: the functions $$g_1,g_2,$$ and $$g_3$$ are actually called the Legendre polynomials, and if you are ever interested in learning more about them, all it takes is a quick Google search to learn more.

• Thank you for the answer! I did some final calculations and seem to have gotten a final answer of $g(x)$ $=$ $(3/5)$$x. Could you be so kind to tell me if this is correct or not? – sktsasus Nov 16 '18 at 5:52 • From what I can tell, yes, this is correct! – Josh B. Nov 16 '18 at 22:13 What you've done so far is correct. The basis you've found are scalar multiples of the Legendre Polynomials, which is what you should get. In this case the norm would be $$\sqrt{\langle h,h\rangle}$$ for an arbitrary vector $$h$$. In general you find norms of inner product spaces by taking square roots. For the projection of any function $$h$$ function where $$\langle h,h\rangle$$ is defined would be given by $$\hat{h}(x)=\dfrac{\langle h,1\rangle}{\langle1,1\rangle}1+\dfrac{\langle h,x\rangle}{\langle x,x\rangle}x+\dfrac{\langle h,(x^2-1/3)\rangle}{\langle (x^2-1/3),(x^2-1/x)\rangle}(x^2-1/3).$$ This method can generalize to other inner product spaces where you have an orthogonal basis. You can simplify the above expression by unitizing (orthonormal), but it's not necessary. The big deal is orthogonality. • Thank you for the answer! I did some final calculations and seem to have gotten a final answer of g(x) = (3/5)$$x$. Could you be so kind to tell me if this is correct or not? – sktsasus Nov 16 '18 at 5:52
• It is correct. One way to check if you have the best approximation of a function $x^3$ is that $x^3-g$ should be orthogonal to $\text{Span}(1,x,x^2)$, which it is. This is a property unique to orthogonal projections (best approximations). – Melody Nov 16 '18 at 8:15