# How to find the orthogonal complement

The question is, considering

• The vector space $$\mathcal{P}_3(\mathbb{R})$$ of the polynomials with real coefficients of degree $$\leq$$ 3
• The inner product defined by $$\left=\int_{-1}^{1}pq$$

how to find a basis for the orthogonal complement of the space spanned by $$\{x-1, x^2+3\}$$?

I tried making $$\int_{-1}^{1}(x-1)p(x)=0$$ and $$\int_{-1}^{1}(x^2+3)p(x)=0,$$ which gave me the spanning sets $$\{x^3+\frac{1}{5}, x^2-\frac{1}{3}, x+\frac{1}{3}\}$$ and $$\{x^3, x^2-\frac{9}{25}, x\}$$ respectively. Then I think we may determine a basis for the intersection os these subspaces, but didn't see how.

Let $$\textsf{W}=\operatorname{span}(\{x-1,x^2+3\})$$ be the subspace of $$\textsf{P}_3(\mathbb R)$$. Then $$p(x)\in \textsf{W}^\perp$$ if and only if $$\langle p(x),x-1\rangle=\int_{-1}^1 p(x)(x-1)dx=0$$ $$\langle p(x),x^2+3\rangle=\int_{-1}^1 p(x)(x^2+3)dx=0$$ at the same time, since $$\{x-1,x^2+3\}$$ is a basis for $$\textsf{W}$$. Let $$p(x)=a_3x^3+a_2x^2+a_1x+a_0$$ for some scalars $$a_0,a_1,a_2,a_3$$. Then, the two above equations are equivalent to \left\{\begin{align} -2a_0+\frac{2}{3}a_1-\frac{2}{3}a_2+\frac{2}{5}a_3=0 \\ \frac{20}{3}a_0+\frac{12}{5}a_2=0 \end{align}\right. (after perform every integral) and solving this last system gives us $$a_2=-\frac{25}{9}a_0, \qquad a_3=\frac{10}{27}a_0-\frac{5}{3}a_1$$ Making $$a_0=t$$ and $$a_1=s$$, we can guarantee that \begin{align} \textsf{W}^\perp&=\left\{ \left(\frac{10}{27}t-\frac{5}{3}s\right)x^3-\frac{25}{9}tx^2+sx+t:\, s,t\in \mathbb R\right\} \\ &=\operatorname{span}\left(\left\{ \frac{10}{27}x^3-\frac{25}{9}x^2+1,-\frac{5}{3}x^3+x \right\}\right) \end{align}

Write a linear combination of one of the spanning spaces, such as $$ax^3 + b\left(x^2-\frac{9}{25}\right) + cx$$ and take the inner product with the other polynomial (in this case $$x-1$$). Set it equal to zero and solve for $$c$$, then plug it back into the above expression and collect terms proportional to $$a$$ and $$b$$ to get a spanning set orthogonal to both.

You could also use the Gram-Schmidt process on the basis $$\{x - 1, x^2 + 3, 1, x^3\}$$ (the last two vectors are arbitrary elements of the complement of the span of $$\{x-1,x^2+3\}$$). At the end of the process, the last two vectors will be an orthogonal basis for the the orthogonal complement of the span of the first two.

You are looking for two linearly independent polynomials such that $$\int_{-1}^{1}(x-1)p(x)=0$$ and $$\int_{-1}^{1}(x^2+3)p(x)=0$$

Assuming $$p(x)= a+bx+cx^2+dx^3$$ we get $$\int_{-1}^{1}(x-1)p(x)=-2a+(2/3)b-(2/3)c+(2/5)d=0$$ and $$\int_{-1}^{1}(x^2+3)p(x)dx= (20/3)a+(12/5)c=0$$

The polynomials $$(3/2)x-(5/2)x^3$$ and $$(-1/2)+(3/2)x^2$$ satisfy the orthogonality conditions.

Thus you may choose the $$\{ 3x-5x^3, -1+3x^2\}$$ as your basis.