<s>[INST] 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<p,q\right>=\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.
 [/INST] 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}$$
</s>