Find constant $a$ that minimizes expression $\sum_{k=0}^{r}\frac{(y_k - a\sin(x_k))^2}{\ln(1+x_k^2)}$ $ E(a) = \displaystyle\sum_{k=0}^{r}\frac{(y_k - a\sin(x_k))^2}{\ln(1+x_k^2)}$
I need to find constant $a$ that minimizes this expression $E(a)$. I'ts long time since I've done calculus so I need some guidance. I think I should start from $\frac{\partial E(a)}{\partial a} = 0$
Ok, so $\displaystyle\frac{\partial E(a)}{\partial a} = \sum_{k=0}^{r}\frac{2\sin(x_k)(-y_k + a\sin(x_k))}{\log(1+x_k^2)}$. What now?
 A: Starting from where you left off, the derivative is: 
$\dfrac{\partial E(a)}{\partial a} = \displaystyle\sum_{k=0}^{r}\dfrac{2\sin(x_k)(-y_k + a\sin(x_k))}{\log(1+x_k^2)} = -\left(\sum_{k=0}^{r}\dfrac{2\sin(x_k)y_k}{\log(1+x_k^2)}\right)+a\left(\sum_{k=0}^{r}\dfrac{2\sin^2(x_k)}{\log(1+x_k^2)}\right)$.
Setting this equal to zero and solving yields $a = \dfrac{\displaystyle\sum_{k=0}^{r}\dfrac{\sin(x_k)y_k}{\log(1+x_k^2)}}{\displaystyle\sum_{k=0}^{r}\dfrac{\sin^2(x_k)}{\log(1+x_k^2)}}$.
A: You can write this equation in matrix-vector form as $E(a) = (\vec{y} - a\vec{s})^TD(\vec{y} - a\vec{s})$, where
$$
\vec{y} = (y_0,\ldots,y_r)^T, \quad \vec{s} = (\sin(x_0),\ldots,\sin(x_r))^T,
$$
and $D$ is the $(r+1)\times (r+1)$ diagonal matrix with nonnegative diagonal elements $d_{ii} = 1/\ln(1+x_i^2)$. I assume that $x_i \neq 0$ for all $i = 0,\ldots, r$. Expanding, it follows that
$$
E(a) = (\vec{s}^TD\vec{s})a^2 - 2(\vec{s}^TD\vec{y})a + \vec{y}^TD\vec{y},
$$
that is, $E$ is a polynomial in $a$ of degree at most two. From here you can use calculus to find the minimum value by considering different cases on the coefficients of $E$.
A: This seems simple ... but I don't think there is a minimum.
You just take the derivative with respect to $a$  and set the resulting expression to zero. Solving for $a$ will find $a$ that gives you extreme (min or max) for $E(a)$. It's a linear equation, so there only the one solution.
However, the second derivative is always negative (for real $x$'s ) so this is a maximum not a minimum.
-Traruh
