# Orthogonal Linear Combinations

Use orthogonality to write the polynomials $1,x,x^2$ as linear combinations of the orthogonal basis of $p_1(x) =1, p_2(x) = x - \frac{1}{2}, p_3(x) = x^2 - x + \frac{1}{6}$ .

$x = \frac{1}{2}p_1(x) + p_2(x).$

But how did they get that? I know how to do these types of problems in $\mathbb{R^n}$ space but not in function space?

-
What's the inner product you are given? – Mhenni Benghorbal Oct 21 '12 at 4:40
it says <p,q> .. – Q.matin Oct 21 '12 at 4:47

The polynomial $1$ is obviously just $p_1$.

The polynomial $x$ is almost $p_2$, except $p_2$ has that constant $-\frac{1}{2}$. We want to get rid of that constant. Well, $p_1$ is also constant, so we can use that: scale $p_1$ so that it exactly matches the constant term we're trying to get rid of (but opposite sign), then add it. This gives $x=\frac{1}{2}p_1+p_2$.

But now what about $x^2$? Well, $x^2$ is almost $p_3+p_2$, except again, the constant term isn't quite right. So... using the above as an example, how do we correct the constant term to get $x^2$ in terms of this basis?

EDIT: I overlooked the bit about using orthogonality. Apologies. Here's a solution using orthogonality that's much more general than this specific circumstance:

There is a nice result (that you presumably have seen if this problem has been assigned) that says given an orthogonal basis $\{v_1,\ldots,v_n\}$ for a vector space with inner product $\langle\cdot, \cdot\rangle$, any vector $u$ in the space can be writen $$u=\frac{\langle u, v_1\rangle}{|v_1|^2}\,v_1+\cdots+\frac{\langle u, v_n\rangle}{|v_n|^2}\,v_n\,.$$ So for this problem, the $p_i$'s are the $v_i$'s, and the polynomials $1$, $x$, and $x^2$ each play the role of $u$.

-
I think you aren't using orthogonality. – Gerry Myerson Oct 21 '12 at 4:37
@GerryMyerson: Whoops! Quite right. Editing in process. – Bey Oct 21 '12 at 4:40
Hm, I am a bit confused? Aren't I suppose to be integrating ? – Q.matin Oct 21 '12 at 4:42
@Q.matin:That's what I already asked you! – Mhenni Benghorbal Oct 21 '12 at 4:43
@MhenniBenghorbal lol I am not sure what you asked me? – Q.matin Oct 21 '12 at 4:48

Let $v_1,\dots,v_n$ be an orthogonal basis for a vector space $V$, and let $v$ be in $V$, so $$v=c_1v_1+\cdots+c_nv_n\tag1$$ for some scalars $c_1,\dots,c_n$. You want to know how to find the $c_i$. Take the inner product of (1) with $v_i$; use properties of the inner product, and orthognality of the basis, and $c_i$ should pop out at you.

-
Thank you, I did what you said and I got that $c_1$ = $\frac{1}{2}$ , $c_2$ = 1, but $c_3$ = 19 which is wrong because it should equal 0? Can you elaborate a bit more? – Q.matin Oct 21 '12 at 5:01
No, but you can show us what you did, and we'll find the mistake, if there is one. You haven't even said what the inner product is, and without that information there is no way any of us can complete the problem. – Gerry Myerson Oct 21 '12 at 5:15
For the last one this is what I did. $\langle x^2, x^2-x+\frac{1}{6}\rangle=\int_0^1 (x^4-x^3+\frac{x^2}{6})\,dx$ which gave me the answer of 19. And the inner product is <p,q> in $L^2$ – Q.matin Oct 21 '12 at 5:26
Any ideas what I did wrong there? – Q.matin Oct 21 '12 at 5:40
I take it you are trying to find $c_1,c_2,c_3$ such that $x^2=c_1p_1+c_2p_2+c_3p_3$. I'll assume you've already checked that $p_1,p_2,p_3$ are orthogonal. Then $x^2*p_3=c_3p_3*p_3$ (where I'm writing $*$ for the inner product), from which you can get $c_3$. I got $x^2*p_3=37/180$. What did you get? What did you get for $p_3*p_3$? – Gerry Myerson Oct 21 '12 at 9:10

Here are nice notes. Write $x$ as

$$x=ap_1+bp_2+cp_3 \,,$$

and use the orthogonality condition $<p_i,p_j>=0$ to find the constants.

-
Thank you, everyone gave me the same answer so I did what you guys said and I got that $c_1$ = $\frac{1}{2}$ , $c_2$ = 1, but $c_3$ = 19 which is wrong because it should equal 0? Can you elaborate a bit more? – Q.matin Oct 21 '12 at 5:03

If the inner product is $\langle f,g \rangle=\int_0^1f(x)g(x)dx$ then eveyrthing follows from what Gerry mentioned.

-
Thank you, everyone gave me the same answer pretty much and I got that $c_1$ = $\frac{1}{2}$ , $c_2$ = 1, but $c_3$ = 19 which is wrong because it should equal 0? Can you elaborate a bit more? – Q.matin Oct 21 '12 at 5:06
Boba, no matter what the inner product is, everything follows from what I wrote. – Gerry Myerson Oct 21 '12 at 5:16
I agree, but without a specific inner product in mind you won't get a numerical value for these coefficients. In fact, different inner products would even produce different values for these coefficients. – BobaFret Oct 21 '12 at 5:21