Generalizing demand for perfect substitutes utility function I have the utility function:
$U(x_1,...,x_n)=a_0+\sum_{i=1}^{n}a_ix_i\;\;\;\;\;\;\;\;\;a_j\in\mathbb{R}_+ \;\;\forall j=\{0,...,n\}$ (maybe $a_0$ could be zero)
$\sum_{i=1}^{n}a_i\in (0,K)\;\;\;$ where $K&lt;\infty$
Where the problem is:
$\max_{x_1,...,x_n}U\;\;\;\;\;\;\;\;c.t.\;\;\sum_{i=1}^{n}p_ix_i=m\;\;\;\;\;$ (With positive prices and income)
Which is the general case for perfect substitutes preferences for finding Walrasian-Marshallian demands. In the particular case $n=2$ the solution could be found geometrically, and the optimum turns out to be one of three cases (where two of them are corner solutions) depending on the relation between prices and parameters $a$. When $p_1/p_2&gt;a_1/a_2$ solution is $(x_1^*=0, x_2^*=m/p_2)$, and the opposite case she spends all income in $x_1$, and the third case is a continuum of feasible points that satisfy the budget constraint.
So, here's the question: Is there a way to obtain a generalized Walrasian-Marshallian demand function (I imagine it would be by parts) for $n$-goods in this case, just like in Cobb-Douglas preferences that it turns out to be $x_i^m=\frac{a_im}{p_i\sum_{i=1}^{n}a_i}$ (please prove).
Let $b_i := \frac{a_i}{p_i}$, now choose the good that maximize $b_i$, let it be $b_j$ i.e. the $j$th good. Optimal choice is $x_j=m/p_j$, and $x_i = 0$ for $i\neq j$.