Fit a line with zero $y$-intercept ($\hat{y} = ax)$ on the curve $y=x^2+x$. Instead of minimizing the sum of squares of the errors, minimize the following objective function:
$$\sum_i \left[ \left(\frac{y^i}{\hat{y}^i}\right)^2 + \left(\frac{\hat{y}^i}{y^i}\right)^2 \right]$$
We are allowed to assume that the distribution of $x$ is uniform on $[0,1]$. What is the optimal value for $a$?
I know how to minimize using sum of squares but I do not know how to minimize using the following function. Could someone please show how to solve this problem?
$$f(a)=\int_0^1 \left(\left(\frac{x^2+x}{a x}\right)^2+\left(\frac{a x}{x^2+x}\right)^2\right) \, dx=\frac{a^2}{2}+\frac{7}{3 a^2}$$ $$f'(a)=a-\frac{14}{3 a^3}$$ $$f'(a)=0\to 3a^4-14=0\to a=\sqrt[4]{\frac{14}{3}}\approx 1.47$$ as $f''(a)=\frac{14}{a^4}+1$ it is positive at $a=1.47$ which is actually a minimum.