I have this problem, could you guys help me? And how can I code this in Python? Thank you so much!
Calculate max value of: $x_1x_2 + x_1x_3 + ... + x_{n-1}x_n = \displaystyle \sum_{1 \le i < j \le n}x_ix_j$,
given that $x_1 + x_2 + ... + x_n = 1$.
I have this problem, could you guys help me? And how can I code this in Python? Thank you so much!
Calculate max value of: $x_1x_2 + x_1x_3 + ... + x_{n-1}x_n = \displaystyle \sum_{1 \le i < j \le n}x_ix_j$,
given that $x_1 + x_2 + ... + x_n = 1$.
You have: $(x_1+x_2+\cdots + x_n)^2 = 1 \implies \displaystyle \sum_{1 \le i < j \le n} x_ix_j= \dfrac{1-x_1^2-x_2^2-\cdots - x_n^2}{2}\le \dfrac{1 - \dfrac{(x_1+x_2+\cdots +x _n)^2}{n}}{2}= \dfrac{1-\dfrac{1}{n}}{2}= \dfrac{n-1}{2n}$. This is the max value of the given sum with equality occur when $x_1 = x_2 = \cdots = x_n = \dfrac{1}{n}$.