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}$ .

They answer is:
$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? 
 A: 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.  
A: 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$.
A: 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. 
A: If the inner product is $\langle f,g \rangle=\int_0^1f(x)g(x)dx$ then eveyrthing follows from what Gerry mentioned.
