Solution (source code)

= Solution

The <arithmetic-geometric mean inequality> for the positive numbers $x$ and $a/x$ gives
$$
g(x)=\frac12\left(x+\frac ax\right)\geq\sqrt a.
$$
Equality holds precisely when $x=a/x$, hence at $x=\sqrt a$. Thus $\boxed{\min_{x>0}g(x)=\sqrt a}$, attained only at $\boxed{x=\sqrt a}$. Equivalently, the exact identity $g(x)-\sqrt a=(x-\sqrt a)^2/(2x)$ proves the same global bound.