# How to minimise this function?

• I
I tried calculating the partial derivative of

##\varphi\left(x, y\right) = \sum_\lambda\left\{H\left(\lambda\right) \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]^2\right\}##

with respect to ##a_n## and equating it to zero to minimise the function (please check my computation).

\begin{eqnarray*}
\frac{\partial \varphi\left(x, y\right)}{\partial a_n} &=& \frac{\partial}{\partial a_n} \sum_\lambda\left\{H\left(\lambda\right) \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]^2\right\} \\
&=& \sum_\lambda \frac{\partial}{\partial a_n} \left\{H\left(\lambda\right) \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]^2\right\} \\
&=& \sum_\lambda H\left(\lambda\right) \frac{\partial}{\partial a_n} \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]^2 + \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]^2 \frac{\partial}{\partial a_n} H\left(\lambda\right)
\end{eqnarray*}

Since ##H\left(\lambda\right)## is not a function of ##a_n##, its partial derivative is zero, and thus the second term vanishes. For the partial differentiation in the first term

\begin{eqnarray*}
\frac{\partial}{\partial a_n} \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]^2 &=& 2\left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right] \times \frac{\partial}{\partial a_n} \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right].
\end{eqnarray*}

The second term of the previous equation is

\begin{eqnarray*}
\frac{\partial}{\partial a_n} \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right] &=& \frac{\partial}{\partial a_n} C_E\left(\lambda; x, y\right) + \frac{\partial}{\partial a_n} \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)
\end{eqnarray*}

The first term is not a function of ##a_n##, thus it also vanishes, while the second term is

\begin{eqnarray*}
\frac{\partial}{\partial a_n} \sum_n a_n\left(x, y\right) e_n\left(\lambda\right) &=& \sum_n \left[\frac{\partial}{\partial a_n} a_n\left(x, y\right) e_n\left(\lambda\right)\right] \\
&=& \sum_n \left[a_n\left(x, y\right)\frac{\partial}{\partial a_n} e_n\left(\lambda\right) + e_n\left(\lambda\right) \frac{\partial}{\partial a_n} a_n\left(x, y\right)\right] \\
&=& \sum_n e_n\left(\lambda\right)
\end{eqnarray*}

Plugging-in everything back,

\begin{eqnarray*}
\frac{\partial}{\partial a_n} \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right] &=& \sum_n e_n\left(\lambda\right) \\
\frac{\partial}{\partial a_n} \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]^2 &=& 2\left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right] \times \sum_n e_n\left(\lambda\right) \\
\frac{\partial \varphi\left(x, y\right)}{\partial a_n} &=& \sum_\lambda H\left(\lambda\right) \times 2\left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right] \times \sum_m e_m\left(\lambda\right) \\
&=& \sum_\lambda \left[2 H\left(\lambda\right) C_E\left(\lambda; x, y\right) \sum_m e_m\left(\lambda\right) + 2 H\left(\lambda\right) \sum_n a_n\left(x, y\right) e_n\left(\lambda\right) \sum_m e_m\left(\lambda\right)\right]
\end{eqnarray*}

Note that I changed the last summation from ##n## to ##m## to avoid confusion with the other summation.

From here, I need to equate it to zero to minimise the function and solve for ##a_n##, but I don't know how.

## Answers and Replies

mfb
Mentor
Note that I changed the last summation from n to m to avoid confusion with the other summation.
Is that implied in the previous steps as well, or do you want to calculate the derivative with respect to the last element? Either way, the sum should go away, assuming
$$\frac \partial {\partial a_k} a_m \neq 1$$ in general.

I actually don't know what I am doing... Sorry.

The range of values of ##m## and ##n## are the same, so is it unnecessary to change the variables?

I also just thought of that the partial derivative goes from every value of ##a_n##. So, the partial derivative goes as ##\frac{\partial}{\partial a_1}##, then ##\frac{\partial}{\partial a_2}##, and so on.

Either way, the sum should go away,

Yes, I thought so too. Then, correcting my computation for ##n = 1## as an example,

\begin{equation*}
\frac{\partial}{\partial a_1} \sum_{n = 1}^{+\infty} a_n\left(x, y\right) e_n\left(\lambda\right) = e_1\left(\lambda\right).
\end{equation*}

Is this correct?

mfb
Mentor
Right.

And it is useful to have separate names (n, m) everywhere.

Thank you. The partial derivative of the function with respect to ##a_1## as an example is

\begin{eqnarray*}
\frac{\partial \varphi\left(x, y\right)}{\partial a_1} &=& \sum_\lambda H\left(\lambda\right) \left\{2 \left[C_E\left(\lambda; x, y\right) + \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right] \cdot e_1 \left(\lambda\right) \right\} \\
&=& \sum_\lambda \left[2 H\left(\lambda\right) C_E\left(\lambda; x, y\right) e_1\left(\lambda\right) + 2 H\left(\lambda\right) e_1\left(\lambda\right) \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right]
\end{eqnarray*}

And equating this to zero to minimise it,

\begin{eqnarray*}
\sum_\lambda \left[2 H\left(\lambda\right) C_E\left(\lambda; x, y\right) e_1\left(\lambda\right) + 2 H\left(\lambda\right) e_1\left(\lambda\right) \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)\right] &=& 0 \\
\sum_\lambda 2 H\left(\lambda\right) C_E\left(\lambda; x, y\right) e_1\left(\lambda\right) + \sum_\lambda 2 H\left(\lambda\right) e_1\left(\lambda\right) \sum_n a_n\left(x, y\right) e_n\left(\lambda\right) &=& 0 \\
\sum_\lambda 2 H\left(\lambda\right) C_E\left(\lambda; x, y\right) e_1\left(\lambda\right) &=& - \sum_\lambda 2 H\left(\lambda\right) e_1\left(\lambda\right) \sum_n a_n\left(x, y\right) e_n\left(\lambda\right) \\
\sum_\lambda H\left(\lambda\right) C_E\left(\lambda; x, y\right) e_1\left(\lambda\right) &=& - \sum_\lambda H\left(\lambda\right) e_1\left(\lambda\right) \sum_n a_n\left(x, y\right) e_n\left(\lambda\right)
\end{eqnarray*}

The missing variable here are the ##a_n## which I can solve by taking the partial derivate of ##\varphi \left(x, y\right)## with respect to ##a_2##, ##a_3##, and so on. I wonder if this is possible on the right-hand side of the previous equation:

\begin{eqnarray*}
- \sum_\lambda H\left(\lambda\right) e_1\left(\lambda\right) \sum_n a_n\left(x, y\right) e_n\left(\lambda\right) &=& - \sum_\lambda \sum_n a_n\left(x, y\right) e_n\left(\lambda\right) H\left(\lambda\right) e_1\left(\lambda\right) \\
&=& - \sum_n \sum_\lambda a_n\left(x, y\right) e_n\left(\lambda\right) H\left(\lambda\right) e_1\left(\lambda\right) \\
&=& - \sum_n a_n\left(x, y\right) \sum_\lambda e_n\left(\lambda\right) H\left(\lambda\right) e_1\left(\lambda\right)
\end{eqnarray*}

mfb
Mentor
If n does not depend on ##\lambda##, that is fine.

Alright. As far as I know, ##n## and ##\lambda## are independent from each other. Thank you for your help.