# Solve: $\sum_{i=1}^n \max\left\{x-a_i,0 \right\}=1.$

Given $a_1,a_2,\ldots,a_n \in\mathbb{R}$. Solve the following equation on $\mathbb{R}$: $$\sum_{i=1}^n \max\left\{x-a_i,0 \right\}=1.$$

I am not sure that a closed-form solution exists, so iterative solutions are also welcome.

-

Without loss of generality, suppose that $a_1\leq a_2\leq\ldots\leq a_n$. We can distinguish several cases.
Case 1 Suppose that $x<a_1$. In this case, $$\sum_{i=1}^n\max\{x-a_i,0\}=0,$$ which can never equal $1$. We can conclude that any solution to the equation must involve $x\geq a_1$.
Case 2 At the other extreme, assume that $x>a_n$. In this case, $$\sum_{i=1}^n\max\{x-a_i,0\}=\sum_{i=1}^n(x-a_i)=n x-\sum_{i=1}^na_i,$$ and this equals $1$ if and only if $$x=\frac{1+\sum_{i=1}^n a_n}{n}.$$ If this value of this candidate solution satisfies $x>a_n$, the leading assumption for this case, then we just found a solution.
Case 3 Assume that $a_m\leq x\leq a_{m+1}$ for some $m\in\{1,\ldots,n-1\}$. Then, $$\sum_{i=1}^n\max\{x-a_i,0\}=\sum_{i=1}^m(x-a_i)+\sum_{i=m+1}^n0=mx-\sum_{i=1}^m a_i.$$ This is equal to $1$ if and only if $$x=\frac{1+\sum_{i=1}^m a_i}{m}.$$ If this value of the candidate solution satisfies also $a_m\leq x\leq a_{m+1}$, then we have found a solution.
By an exhaustive check of all cases (note that Case 3 consists of $n-1$ subcases), which can be automated by a computer program, we can find all solutions.