Find the function $f:\mathbb R\to \mathbb R$, that is continuous and satisfies $$f(x)+\int_0^x tf(t)\ dt+x^2=0$$
My initial idea : First we observe that $f(0) = 0$. Then I wanted to integrate the second summand by using the idea every continuous function is Riemann integrable and so by using a function $g$ and $h$ such that $h''(x) = g'(x) = f(x)$ and the equation I got was $$h'(x) + xh'(x) - h(x) + (x^2 + c) = 0$$ (here $c = h(0)$, a constant).
These types of differential equations are indeed solvable, but the fact the form after solving comes out to be complex and I doubt that this will actually resolve the problem to something good.
Hence I request for a help in this problem.
$f'(x)+xf(x)+2x=0$. This can be written as $(e^{x^{2}/2}f(x))'=-2xe^{x^{2}/2}$. So $f(x)=e^{-x^{2}/2}[c-2\int te^{t^{2}/2}dt]$. where $c$ is a constant. This gives $f(x)=e^{-x^{2}/2}[c-2e^{x^{2}/2}]$. Note that $f(0)=0$ so we must have $c=2$.