Problem

Source: 2017 Thailand October Camp 3.1

Tags: functional equation, algebra



Let $P$ be a given quadratic polynomial. Find all functions $f : \mathbb{R}\to\mathbb{R}$ such that $$f(x+y)=f(x)+f(y)\text{ and } f(P(x))=f(x)\text{ for all }x,y\in\mathbb{R}.$$