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?