Minimizing infinite sum wrt number of terms Consider $\{\lambda_i\}$ such that $\sum_{i=1}^\infty \lambda_i <\infty$. I seek to find closed form for $N$ that minimizes the expression $$\sum_{i=1}^N \lambda_i \frac{\alpha}{(\lambda_i p + \alpha)^2}+ \sum_{i=N+1}^\infty \lambda_i + \sigma^2p\sum_{i=1}^N \frac{\lambda_i}{(\lambda_ip + \alpha)^2} = \sum_{i=1}^N \frac{\lambda_i(\alpha - (\lambda_i p+\alpha)^2 + \sigma^2p)}{(\lambda_i p + \alpha)^2}$$
For constants $\alpha, p, \sigma^2 \in \mathbb{R}_{\ge 0}$. Also assume all $\lambda_i \ge 0$. How should one approach this?
 A: (This replied edited, to match edits in the original question.)
We can add $\sum_{i=1}^N \lambda_i$ to the second summation and subtract it from the first summation to get
$$\sum_{i=1}^N \left( \lambda_i \frac{\alpha}{(\lambda_i p + \alpha)^2} - \lambda_i \right) + \sum_{i=1}^\infty \lambda_i + \sigma^2 p \sum_{i=1}^N \frac{\lambda_i}{(\lambda_i p + \alpha)^2}$$
Since $\sum_{i=1}^\infty \lambda_i$ doesn't contain $N$, we can also ignore it, so now you just need to minimize
$$\sum_{i=1}^N \left( \lambda_i \frac{\alpha}{(\lambda_i p + \alpha)^2} - \lambda_i \right) + \sigma^2 p \sum_{i=1}^N \frac{\lambda_i}{(\lambda_i p + \alpha)^2} = \sum_{i=1}^N \left(  \frac{\lambda_i\alpha}{(\lambda_i p + \alpha)^2} - \lambda_i +  \frac{ \sigma^2 p \lambda_i}{(\lambda_i p + \alpha)^2}\right)$$
$$ = \sum_{i=1}^N \lambda_i\left( \frac{ \alpha - (\lambda_i p + \alpha)^2 + \sigma^2 p }{(\lambda_i p + \alpha)^2}\right)$$
The denominator is always positive, and $\lambda_i$ is always positive, so the sum only gets smaller whenever the numerator $\alpha - (\lambda_i p + \alpha)^2 + \sigma^2 p$ is negative, and gets bigger whenever the numerator is positive.  So your sum is minimized for some $N$ value when $\alpha - (\lambda_N p + \alpha)^2 + \sigma^2 p$ is negative but the next $\alpha - (\lambda_N p + \alpha)^2 + \sigma^2 p$ is positive.  (In other words, when $\lambda_N > \frac{\sqrt{\alpha + \sigma^2 p}-\alpha}{p}$ but $\lambda_{N+1} < \frac{\sqrt{\alpha + \sigma^2 p}-\alpha}{p}$.)  It might be that there are many such $N$ values, so you have several values where local minima occur.  We'd have to know more about the specific values of $\{ \lambda_i \}$ to know which is the absolute minimum.  If $\{ \lambda_i \}$ is strictly decreasing, then there's only one such $N$.
As a side note, we can simplify the numerator using the constraints you gave.
$$\alpha - (\lambda_i p + \alpha)^2 + \sigma^2 p  = \alpha - \lambda_i^2 p^2 -2\lambda_i p \alpha - \alpha^2 + \sigma^2 p$$
$$ = p\left[ - \lambda_i^2 p -2\lambda_i \alpha - \frac{\alpha^2 -\alpha}{p}+ \sigma^2\right]$$
$$ < p\left[ - \lambda_i^2 p -2\lambda_i \alpha - \sigma^2 + \sigma^2\right] 
= p\left[ - \lambda_i^2 p -2\lambda_i \alpha\right]$$
Note that since $\frac{\alpha^2 -\alpha}{p} > \sigma^2$, then $-\frac{\alpha^2 -\alpha}{p} < -\sigma^2$.  Using this simplified numerator gives us a sum that is smaller than the sum above, so it changes which $N$ minimizes the sum.
