Question: How to find the function f like this?

EDIT 
x*f'(x^2)  + g'(x) = cos(x)  - 3x^3 and f(x^2) + g(x) = sin(x) -x^4. 

How to find the function f like this:
x*f'(x)  + g'(x) = cos(x)  - 3x^3 and f(x^2) + g(x) = sin(x) -x^4. 
I know that, f(x) = -1/2*x^2 + C. But, I tried. This answer incorrec. 
restart;
f := x -> -1/2*x^2 + C;
g := x -> sin(x) - 1/2*x^4 - C;
diff(f(x^2), x);
f(x^2) + g(x);
x*diff(f(x^2), x) + diff(g(x), x);

Please Wait...