I'm a freshman in college with no prior experience in non linear optimization. This is a question I encountered in an MCQ format.
Problem
$\ x_i \epsilon Z $
$\ i = {1,2,3,4,5} $
$\sum_{i=1}^5 x_i = 10$
$\sum_{i=1}^5 x_i^2 = 40$
Find the maximum and minimum value that $\ x_i $ can take.
Attempt
I replaced $x_i$ with $k_i + m$ and found
$\ M = \sum_{i=1}^5 k_i = 10-5m$
$\ P = \sum_{i=1}^5 k_i^2 = 40 + 5m^2 - 20m$
Solving $M^2=P$ yielded $m = 1,3$ which generated the solution set
{1,1,1,1,6}
{3,3,3,3,-2}
indicating that 6 and -2 were the required values, however I'm clueless as to why the math worked out in this manner.
Queries
I'd like to know why $M^2=P$ yielded the critical condition, how many solution sets there are to this problem, as well as a general approach to such questions.
This is my first post on this forum, thank you in advance.