This is a restated version of my original very broad question.

Let $P$ be probability a measure on an interval $[a,b]$ ($-\infty<a<b<\infty$) that's dominated by Lebesgue measure. Let $\langle f, g \rangle_P=\int_{[a,b]} f \cdot g \, dP$ be an inner product for integrable functions associated with $P$ and $\| \cdot \|_{L_2(P)}$ denote the induced $L_2$-norm. Let $f: [a,b] \rightarrow \mathbb{R}$ be integrable and $f \in C^r[a,b]$ for some $r \leq \infty$. Consider approximating $f$ by a trigonometric polynomial $a_0+\sum_{k=1}^K [a_k \cos(kx) + b_k \sin(kx)]$. Let $\pi_{K,P}(f)$ denote the projection of $f$ onto the space of $K$-th order trigonometric polynomials with respect to $\langle \cdot, \cdot \rangle_P$. Consider the approximation error $\| f-\pi_{K,P}(f) \|_{L_2(P)}$. Assume $f$ is not a trigonometric polynomial itself.

I've seen an upper bound of this error that looks like $C K^{-r}$ when $r < \infty$ and is derived from the $L_\infty$ error (https://www.springer.com/us/book/9783540506270). Is there a lower bound for the $L_2(P)$ error, ideally with the same structure as the upper bound (maybe under mild conditions)? Also, what would be the upper bound and lower bound if $r=\infty$? I'm particularly interested in the case where $f(x)=x$.

You may take $[a,b]$ to be any interval you want for convenience.

I would be very happy if you know of any results of this kind, perhaps under similar settings (e.g. a different notion of smoothness for $f$ in terms of Soblev spaces).

**Original question:**

Let $P$ be probability a measure on an interval $[a,b]$. Let $\langle f, g \rangle_P=\int_{[a,b]} f \cdot g \, dP$ be an inner product for integrable functions associated with $P$ and $\| \cdot \|_{L_2(P)}$ denote the induced $L_2$-norm. Let $f: [a,b] \rightarrow \mathbb{R}$ be integrable. Let $\phi_1,\phi_2,\ldots: [a,b] \rightarrow \mathbb{R}$ be a basis and I want to use $\sum_{k=1}^K \beta_k \phi_k$ to approximate $f$ for some $\beta_k \in \mathbb{R}$. In particular, let $\pi_{K,P}(f)$ denote the projection of $f$ onto $Span\{\phi_1,\ldots,\phi_K\}$ with respect to $\langle \cdot, \cdot \rangle_P$. Consider the approximation error of $\pi_{K,P}(f)$: $\| f-\pi_{K,P}(f) \|_{L_2(P)}$.

I know there are results on the upper bound of this error. But is there a more accurate estimate (not just an upper bound)? Or is there a lower bound? If so, can you provide a reference?

Here I always assume $f$ is not a linear combination of $\phi_1,\phi_2,\ldots$, i.e. $\pi_{K,P}(f) \neq f$ for any $K<\infty$ and any $P$, so there might be a nontrivial lower bound.

You may consider simplified/restricted versions of this problem. For example, you may take $\phi_k=x^{k-1}$ or $\phi_{2k-1}=\cos((k-1)x), \phi_{2k}(x)=\sin(kx)$ (trigonometric polynomial); you may take $[a,b]=[0,1]$ or $[a,b]=[0,2\pi]$.

You may add other assumptions on $f$ or $P$ as long as they are not too restrictive. For example, assume $f$ is continuously differentiable up to some order or infinitely differentiable; or, assume $P$ is dominated by Lebesgue measure.

Edit 1: Let me try to be more specific. Is there a lower bound of the approximation error when $f(x)=x$ and I use a trigonometric polynomial (with both $\sin$ and $\cos$ series) to approximate? You may assume $[a,b]=[0,2\pi],[0,\pi],[-\pi,\pi]$ or whatever finite interval as you want. The probability measure $P$ has no special property. If necessary, you may assume $P$ is dominated by Lebesgue measure.

Edit 2: Just want to emphasize that I only care the behavior on a finite interval $[a,b]$ instead of the whole real line, so if I use trigonometric polynomial for approximation, I feel $f(x)=x$ not being periodic should not make the approximation behave super badly.