TITLE: Find $f(x)$ such that: $ f'(x) + f(x^2) = 2x + 1 $
QUESTION [8 upvotes]: How to find the function $f(x)$ that is derivable on $\mathbb{R}$ and satisfies the equation:
$$ f'(x) + f(x^2) = 2x + 1 \text{ } \text{ } \forall x \in \mathbb{R}$$

My attempt:
Substitute $-x$ for $x$ in the equation, we have a system of 2 equations :
  \begin{cases} 
f'(x) + f(x^2) &= 2x + 1\\ 
f'(-x) + f(x^2) &= -2x + 1
\end{cases} 
  Take the difference of them, we have: 
  $$ f'(x) - f'(-x) =4x $$ 
  Integrate both sides: 
  $$ f(x) + f(x) = 2x^2 + C_1 $$
  Therefore, we have:
  $$ f(x) = x^2 + C_2 $$

However, this method results in an invalid solution to the original equation. I wonder whether there is another way to solve this problem or why my solution is wrong.
Thanks in advance.

REPLY [3 votes]: Follows a MATHEMATICA script which calculates the series approximation for this ODE. It is convergent for $|x| < 1$
n = 50;
f[x_, n_] := Sum[Subscript[a, k] x^k, {k, 0, n}]
A = Table[Subscript[a, k], {k, 0, n}];
dif = D[f[x, n], x] + f[x^2, n] - 2 x - 1;
equs = Take[CoefficientList[dif, x], {1, n + 1}];
B = equs /. Thread[A -> 0];
M = Grad[equs, A];
solA = LinearSolve[M, -B];

f[x_] := f[x, n] /. Thread[A -> solA]

f'[x] + f[x^2] - 2 x - 1

Plot[f[x], {x, -1, 1}, PlotStyle -> {Thick, Blue}]