Find a polynomial $q \in \mathcal{P}_{2}(\mathbb{R})$ such that
$$p \left(\frac{1}{2} \right) = \int_{0}^{1} p(x)q(x) dx$$
for every $p \in \mathcal{P}_2(\mathbb{R})$.
I am practicing this using Linear Algebra Done Right. Specifically, it appears I need to use the Riesz Representation Theorem:
Suppose $V$ is finite dimensional and $\phi$ is a linear functional on $V$. Then there is a unique vector $u \in V$ such that
$$\phi(v) = \langle v, u \rangle$$
for every $v \in V$.
Particularly, it appears to find the $u$ one has to use
$$u = \overline{\phi(e_1)}e_1 + \dots+ \overline{\phi(e_n)}e_n$$
where $\overline{\phi(e_i)}$ is the complex conjugate of $\phi$ and $e_i$ is an orthonormal basis vector.
Attempt
So I have found an orthonormal basis for $\mathcal{P}_2(\mathbb{R})$ given that we are dealing with polynomials. Let $e_{i}(x)$ be the orthonormal vector. I feel then
$$q(x) = \overline{\phi \left(e_{1} \left(\frac{1}{2} \right) \right)} e_{1} + \overline{\phi \left(e_{2} \left(\frac{1}{2} \right) \right)} e_{2} + \overline{\phi \left(e_{3} \left(\frac{1}{2} \right) \right)} e_{3}$$
Is this the right path to take?
If $q(x)$ is such a polynomial, then it is easy to see that $q(x)-1$ must be orthogonal to $1$ and $x-\frac{1}{2}$ with respect to the inner product $\langle \_,\_\rangle$ on $\mathcal{P}_2(\mathbb{R})$ defined by $$\langle a(x),b(x)\rangle:=\int_0^1\,a(x)\,b(x)\,\text{d}x\text{ for all }a(x),b(x)\in\mathcal{P}_2(\mathbb{R})\,.$$ Thus, we apply the Gram-Schmidt orthonormalization on the basis $\left\{1,x-\frac{1}{2},x^2\right\}$ to get $$\begin{align}q(x)-1&\propto x^2-\frac{\langle 1,x^2\rangle}{\langle 1,1\rangle}\,1-\frac{\langle x-\frac12,x^2\rangle}{\langle x-\frac12,x-\frac12\rangle}\,\left(x-\frac12\right) \\&=x^2-\frac13-\left(\frac{\frac{1}{4}-\frac{1}{6}}{\frac13-\frac12+\frac14}\right)\,\left(x-\frac12\right)\,.\end{align}$$ That is, $$q(x)-1\propto x^2-x+\frac{1}{6}\text{ or }q(x)=A\,\left(x^2-x+\frac16\right)+1$$ for some constant $A$. Since $\langle x^2,q(x)\rangle=\frac14$ must hold, we conclude that $$\frac14=A\,\left(\frac15-\frac14+\frac1{18}\right)+\frac13\,,$$ whence $$A=-15\text{ or }q(x)=-15x^2+15x-\frac32\,.$$ Interestingly, it turns out that, with $q(x)=-15x^2+15x-\frac32$, $$\int_0^1\,p(x)\,q(x)\,\text{d}x=p\left(\frac12\right)$$ for all $p(x)\in\mathbb{C}[x]$ of degree at most $3$.