Find a function $g$ such that $\int_0^{x^2}tg(t)dt = x + x^2$ This problem $5b$ from Chapter $14$ of Spivak's Calculus:

Find a function $g$ such that $\int_0^{x^2}tg(t)dt = x + x^2$ (Note $g$ is not assumed to be continuous at $0$).

I think this question is impossible? First of all there's no restrictions on $x$, so letting $x = 1$ and $x = -1$, we get $0 = 2$.
So maybe we have to restrict to $x \geq 0$? In that case, we can take the square root:
Find $g$ such that $\forall x \geq 0 : \int_0^{x}tg(t)dt = x + \sqrt{x}$
Let $f(t) = tg(t)$, so we need $\int_0^{x}f(t)dt = x + \sqrt{x}$
Now $\frac{d}{dx} (x + \sqrt{x}) = 1 + \frac{1}{2\sqrt{x}}$. But $f(t) = 1 + \frac{1}{2\sqrt{t}}$ won't work because $1 + \frac{1}{2\sqrt{t}}$ isn't bounded as $t \rightarrow 0$, so the integral won't be defined.
Am I missing something?

The function $$g(x) = \frac{1 + 2\sqrt x}{2(\sqrt x)^3}$$ seems to satisfy the condition. Below is how to find it:
Let $G(x) = \int xg(x)dx$. Then, we have
$$\int_0^{x^2}tg(t)dt \overset{\text{(FTC)}}= G(x^2) - G(0) \overset{*}= x + x^2 
 $$
Now, differentiate both sides of $(*)$ to get
$$\begin{align} 2x[x^2g(x^2)] &= 1 + 2x \\[1mm] 2x^3g(x^2) &= 1+ 2x \\ g(x^2) &= \frac{1+2x}{2x^3}.\end{align}$$ Therefore, we get $$g(x) = \frac{1 + 2\sqrt x}{2(\sqrt x)^3} $$

Indeed,
$$\int_0^{x^2} t \frac{1 + 2\sqrt t}{2(\sqrt t)^3} dt = \int_0^{x^2}\left( 1 + \frac{1}{2\sqrt t}\right)dt = \left[\sqrt t + t\right]_0^{x^2} = x + x^2$$ as desired.
