In which case these integrals are equal?

$\newcommand{\d}[1]{\, \mathrm{d}#1}$ To solve for the following equality: $$ \left(\int_0^x f(t) \d{t}\right)^2 = \int_0^x f^3(t) \d{t} $$ We invoke Fundamental Theorem of Calculus and differentiate both sides: $$ 2f(x)\int_0^x f(t) \d{t} = f^3(x) $$ Let $F(x) = \int_0^x f(t) \d{t}$. Note that $F'(x) = f(x)$. If $f(x) \not\equiv 0$, this is equivalent to solving the differential equation $(F'(x))^2 = 2F(x)$. Differentiating again yields: \begin{align*} 2F'(x)F''(x) = 2F'(x) &\implies f'(x)f(x) = f(x) \\ &\;\color{red}{\implies f'(x) = 1} \\ &\implies f(x) = x + C \end{align*} Therefore, the only possible cases are $f(x) = 0$ or $f(x) = x + C$ for some $C \in \mathbb{R}$. Since $f(0) = 0$ we must have $f(x) = x$. I'll leave you to check that these two are indeed solutions to the equality.


EDIT: As @ΑΘΩ has pointed out, more justification is required to show that $f'(x) = 1$ for all $x \in [0, \infty)$, as my argument only proves that $f'(x) = 1$ whenever $f(x) \neq 0$ (the implication in red). This can be fixed by showing that if $f(x) = 0$ for some $x > 0$, then $f(x) \equiv 0$ on $[0, \infty)$. Note that $f(0) = 0$ and $f'(x) \geq 0$ $\forall x \geq 0$ implies $f(x) \geq 0$ $\forall x \geq 0$.

We prove this by contradiction. Suppose $f(x) = 0$ for some $x > 0$ but $f(x) \not\equiv 0$. Let: $$ x_0 = \sup\{x \in [0,\infty) \mid f(x) = 0\} $$ We consider two cases. If $x_0 = +\infty$, then there exists $x_1 < x_2$ such that $f(x_1) = y_1 > 0$ but $f(x_2) = 0$. By MVT, there exists $c \in (x_1, x_2)$ such that $f'(c) = \frac{y_1}{x_1 - x_2} < 0$, contradicting that $f'(x) \geq 0$ for all $x \in [0, \infty)$.

If $x_0 < +\infty$, then we have $f(x) \neq 0$ for $x > x_0$. This means that $f'(x) = 1$ for $x > x_0$, so $\lim_{x \to x_0^+} f'(x) = 1$. Since $f \in C^1[0,\infty) \implies f'$ is continuous, we have $f'(x_0) = 1$. If $f(x_0) = 0$, then there exists $x' < x_0$ sufficiently close to $x$ such that $f(x') < 0$, contradicting $f(x) \geq 0$ so we must have $f(x_0) = y_0 > 0$. However, by continuity of $f$, we have for some $\delta > 0$, $x \in (x_0 - \delta, x_0 + \delta) \implies f(x_0) > \frac{y_0}{2}$, this time contradicting the supremum property of $x_0$. This concludes that $f(x) \equiv 0$.