All positive continuous functions $g$ on $[0,\infty)$ s.t. $\frac{1}{2}\int_0^x [g(t)]^2 dt = \frac{1}{x}\left(\int_0^x g(t)dt\right)^2$. Repeating the title, the question is as followed:

Find all positive continuous functions $g$ on $[0,\infty)$ such that $\frac{1}{2}\int_0^x [g(t)]^2\text{ d}t = \frac{1}{x}\left(\int_0^x g(t)\text{ d}t\right)^2$ for $x > 0$.

Clearly $g(t) = 0$ is a solution, but it is not positive so it is not what the question is asking for. One can check that $g(t)$ can never be a positive constant function. 
I don't really know how to proceed with this question. I conjectured that $g(0) = 0$ necessarily, which implies that no such positive function exists but to no avail.
Any help is appreciated.
 A: Let $g:[0,\infty)\to\mathbb{R}$ be a continuous function such that
$$\dfrac{x}2\,\int_0^x\,\big(g(t)\big)^2\,\text{d}t=\left(\int_0^x\,g(t)\,\text{d}t\right)^2\tag{1}$$
for every $x\geq 0$.  Differentiating both sides with respect to $x$ yields
$$\frac{1}{2}\,\int_0^x\,\big(g(t)\big)^2\,\text{d}t+\frac{1}{2}\,x\,\big(g(x)\big)^2=2\,g(x)\,\int_0^x\,g(t)\,\text{d}t\,.\tag{2}$$
Write $G(x):=\displaystyle\int_0^x\,g(t)\,\text{d}t$ for all $x\geq 0$ (so that $G'=g$).  Then, (1) and (2) imply that
$$\big(G(x)\big)^2+\frac{1}{2}\,x^2\,\big(g(x)\big)^2=2\,x\,g(x)\,G(x)$$
for every $x\geq 0$.  Thus,
$$\big(G(x)-x\,g(x)\big)^2=\frac{1}{2}\,x^2\,\big(g(x)\big)^2$$
for all $x\geq 0$.  By continuity of $G$ and $g$, we conclude that there exists $s\in\{-1,+1\}$ such that $G(x)=\left(1+\frac{s}{\sqrt{2}}\right)\,x\,g(x)$ for each $x\geq 0$.  That is, $$\frac{\text{d}}{\text{d}x}\,\left(\frac{1}{x^{2-\sqrt{2}\,s}}\,G(x)\right)=0\text{ for each }x>0\,.$$
That is, for some constant $k$, $G(x)=k\,x^{2-\sqrt{2}\,s}$ for all $x>0$.  By continuity, $G(x)=k\,x^{2-\sqrt{2}\,s}$ for every $x\geq 0$.  Hence, $$g(x)=G'(x)=K\,x^{1-\sqrt{2}\,s}$$ for all $x\geq 0$, where $K:=\left(2-\sqrt{2}\,s\right)\,k$.  However, $g(x)$ must be defined at $x=0$.  This implies $s=-1$.  Thus,
$$g(x)=K\,x^{1+\sqrt{2}}\text{ for all }x\geq 0\,.$$
We can check that $g$ satisfies the requirement:
$$\int_0^x\,g(t)\,\text{d}t=\frac{K\,x^{2+\sqrt{2}}}{2+\sqrt{2}}$$
and
$$\int_0^x\,\big(g(t)\big)^2\,\text{d}t=\frac{K^2\,x^{3+2\sqrt{2}}}{3+2\sqrt{2}}$$
for all $x\geq 0$.  Since
$$\left(\frac{1}{2+\sqrt{2}}\right)^2=\frac{1}{2}\left(\frac{1}{3+2\sqrt{2}}\right)\,,$$
every such $g$ satisfies the equation (1).
In general, for $\alpha\in\mathbb{R}$, there exists a nonzero continuous function $g:[0,\infty)\to\mathbb{R}$ such that
$$\alpha\,x\,\int_0^x\,\big(g(t)\big)^2\,\text{d}x=\left(\int_0^x\,g(t)\,\text{d}t\right)^2$$
for all $x\geq 0$ if and only if $0<\alpha\leq 1$.  For $\alpha\in (0,1]$, all solutions are of the form
$$g(x)=K\,x^{\frac{1-\alpha+\sqrt{1-\alpha}}{\alpha}}$$
for all $x\geq 0$, where $K$ is a constant.
