TITLE: Is there such splitting?
QUESTION [5 upvotes]: Does there exist a set $A \subset [0,1]$ s. t. for every polynomial $P(x)$ of degree less than or equal to $4$ the relation between the Riemann integrals
$$\int_A P(x)\,dx= \int_{[0,1]\setminus A}P(x)\,dx $$ holds?

REPLY [4 votes]: Here is a "Cantor-like" construction that works for any degree $n\geq 4$.
Define a partition $(A_n,B_n)$ of $[1,2^{n+1}]$ by induction as follows :
$(A_0,B_0)=(\lbrace 1\rbrace,\lbrace 2 \rbrace)$ and for $n\geq 2$,
$A_n=B_{n-1}\cup (A_{n-1}+2^{n+1}), B_n=A_{n-1}\cup (B_{n-1}+2^{n+1})$.
Lemma. If $g$ is a polynomial of degree $\leq n$ in $x$,
then $\sum_{k\in A_n}g(x+k)=\sum_{k\in B_n}g(x+k)$.
Proof of lemma : Use induction on $n$. When $n=0$, the lemma states that 
$g(x+1)=g(x+2)$ when $g$ is constant, and this is certainly true. Suppose that the lemma holds for $n-1$ where $n\geq 1$. Let $g$ have degree $\leq n$. Define $h$  by $h(x)=g(x+2^{n+1})-g(x)$. Then $h$ has degree $\leq n-1$, so by the induction hypothesis we have $(1)\sum_{k\in A_{n-1}}h(x+k)=\sum_{k\in B_{n-1}}h(x+k)$. Now, since $h(x+k)=g(x+2^{n+1}+k)-g(x+2^{n+1})$ the LHS in (1) above is equal to 
$\sum_{k\in A_{n-1}+2^{n+1}}g(x+k)-\sum_{k\in A_{n-1}}g(x+k)$, while
the RHS in (1) above is equal to 
$\sum_{k\in B_{n-1}+2^{n+1}}g(x+k)-\sum_{k\in B_{n-1}}g(x+k)$. It is clear then
that (1) shows that the lemma is true for $n$. This concludes the proof by induction.
Returning to the initial problem, if $f$ is a polynomial of degree
$\leq n$, then $F(k)=\int_{\frac{k-1}{2^{n+1}}}^{\frac{k}{2^{n+1}}} f(x)dx$ is a polynomial of degree $\leq n$ in $k$. It follows then from the lemma that the following
$A$ works : 
$$
A=\bigcup_{k\in A_n} [\frac{k-1}{2^{n+1}},\frac{k}{2^{n+1}}]
$$
When $n=4$, one has
$$
\begin{array}{lcl}
 A &=& \bigcup_{k\in \lbrace 1; 4; 6; 7; 10; 11; 13; 16; 18; 19; 21; 24; 25; 28; 30; 31 \rbrace}\big[\frac{k-1}{32},\frac{k}{32}\big] \\
[0,1] \setminus A &=&
\bigcup_{k\in \lbrace 2; 3; 5; 8; 9; 12; 14; 15; 17; 20; 22; 23; 26; 27; 29; 32\rbrace}\big[\frac{k-1}{32},\frac{k}{32}\big]
\end{array}
$$