How to find minimum of a function with a conditional sum?

79 Views Asked by At

I am tasked to find the closed form solution to$$\min_{y} \ - ky + \sum_{i=1}^{n} (y-x_{i})_{+}$$ where $(y-x_{i})_{+}$ is equivalent to $max(0 , y-x_{i})$

My first thought is to find and set the derivative of the function to $0$ but I'm not sure how to do that in this format.

1

There are 1 best solutions below

1
On BEST ANSWER

Define the function $$f(y)=-ky+\sum_{i=1}^n \max(0, y-x_i)$$ Without loss of generality, assume that $x_1,x_2,...,x_n$ are in increasing order. Like I said in my comment, we shouldn’t try to take derivatives since $f$ is not differentiable, but we can notice that its graph consists of a sequence of connected line segments whose slopes satisfy some nice properties.

The slope of the first line “segment,” which goes on to $-\infty$, is equal to $-k$. Then, to the right of $x=x_1$, we get a line segment with slope $-k+1$, and to the right of $x=x_2$ we have a line segment with slope $-k+2$, and so on. To reach the minimum, we need to keep going until the slope becomes positive, which occurs once $-k+i$ becomes positive. This occurs when $x=x_{\lceil k \rceil}$. Thus, the minimum value is obtained at $x=x_{\lceil k \rceil}$, and this minimum value is given by $f(x_{\lceil k\rceil})$. However, if $k > n$, the function never obtains a minimum value and decreases forever, meaning that arbitrarily small values can be obtained.