Approximate $f(t) = 1-|2t-5|$ in $[2,3]$ by $p\in P_2$ by using the least squares method in respect to $\langle f,g\rangle = \int_2^3 f(x)g(x) \ dx$ (use the Legendre polynomials)
I think I need to project $p$ onto the subspace generated by $f(t)$ but I don't know how to do this because I should do
$$\langle p-f(t),something\rangle$$
Or should I do $\langle f(t)-p,1\rangle=0, \langle f(t)-p,t\rangle=0, \langle f(t)-p,t²\rangle=0$?
Can somebody give me a ligth?
If you are due to use Legendre polynomials, you have to
Instead of $t \in [2,3]$, take variable $T \in [-1,1]$
using coordinates change
$$T=2t-5 \tag{1}$$
Meanwhile, expression $f(t)$ is changed into expression $F(T)=1-|T|.$
Then, the looked for quadratic $Q(T)$ is the beginning of the infinite expansion limited to its 3 first terms : $$F(T)=\underbrace{a_0L_0(T)+a_1L_1(T)+a_2L_2(T)}_{Q(T)}+...$$
(see https://en.wikipedia.org/wiki/Legendre_polynomials).
You should find $a_0=\tfrac12, a_1=0, a_2=-\tfrac58$, giving
$$Q(T)=\tfrac12-\tfrac{5}{16}(3T^2-1)$$
which is indeed very satisfactory (see Fig. 1).
(best quadratic approximation).
Fig. 1 : In red (resp. blue), curve with equation $Y=F(T)$ (resp. $Y=Q(T)$, its best quadratic approximation) on reference interval $[-1,1]$.