I'm practicing Lagrange Multipliers (LM)$^{[1]}$ with the following self-made question:
Given $a + b + c + d + e = 1$, where $a, b, c, d, e \notin R^-$. Find the maximum value of $ab + bc + cd + de$
I already know that the answer is $1/4^{[2]}$. But, as an exercise, I want to use LM.
My Attempt:
Let, $$ f(a, \ ... \ ,e) = ab + bc + cd + de \\ g(a, \ ... \ ,e) = a + b + c + d + e = 1 $$
Then, define: $$ \mathcal{L}(a, \ ... \ ,e, \lambda) = f(a, \ ... \ ,e) - \lambda \cdot [g(a, \ ...\ ,e) - 1] \\ \therefore \mathcal{L}(a, ... ,e, \lambda) = ab + bc + cd + de - \lambda \cdot [a + b + c + d + e - 1] $$
Now, $\nabla\mathcal{L} = 0$ would give maxima / minima. On partial differentiation, we get,
$$ \begin{align} b = \lambda \qquad (from \ \ \frac{\delta\mathcal{L}}{\delta a}) \tag 1\\ d = \lambda \qquad (from \ \ \frac{\delta\mathcal{L}}{\delta e}) \tag 2\\ a + c = \lambda \qquad (from \ \ \frac{\delta\mathcal{L}}{\delta b}) \\ c + e = \lambda \qquad (from \ \ \frac{\delta\mathcal{L}}{\delta d}) \\ b + d = \lambda \qquad (from \ \ \frac{\delta\mathcal{L}}{\delta c}) \tag 3 \end{align}$$
Here, equations $(1)$, $(2)$ and $(3)$ seems contradicting. Why it is so?
Note: I tested the same approach with $2$, $3$ and $4$ variables and it gave me correct results. Why so?
References:
[1]: Lagrange multipliers, examples - Khan Academy
[2]: If $a,b,c,d,e,f$ are non negative real numbers such that $a+b+c+d+e+f=1$, then find maximum value of $ab+bc+cd+de+ef$
The KKT conditions cannot be solved because $x^*$ is not the optimal point using the constraints you have implemented in your Lagrangian. If we do not implement the inequality constraints $$ \begin{align} a \geq 0 \\ b \geq 0 \\ c \geq 0 \\ d \geq 0 \\ e \geq 0 \end{align} $$ then we can let $$a = t, b = t, e = -t, d = -t \text{ and } c=1$$ such for all $t$ the constraint $g(a, \dots, e) = 0$ is satisfied and our function $$f(a, \dots, e) = t^2 +t - t + t^2 = 2t^2$$ is unbounded. We can just let $t\rightarrow \infty$ and our function does not permit a solution.
As @Toni says we must implement also the inequality constraints $a, b, c, d, e \geq 0$ in the Lagrangian. This yields $$ \begin{align} \mathcal{L}(a, b, c, d, e, \lambda, \mu_a, \mu_b, \mu_c, \mu_d, \mu_e) &= ab + bc + cd + de \\ &+ \lambda(a+b+c+d+e-1) \\ & + \mu_a a + \mu_b b + \mu_c c + \mu_d d + \mu_e e \end{align} $$ As you say optimality implies $\nabla \mathcal{L} = 0$ $$ \begin{align} a + \lambda + \mu_a = 0\\ a + c + \lambda + \mu_b = 0 \\ b + d + \lambda + \mu_c = 0 \\ c + e + \lambda + \mu_d = 0 \\ e + \lambda + \mu_e = 0 \end{align} $$ This more flexible system can be solved for $a=b= \frac{1}{2}, c=d=e=0$.
$$ \begin{align} a + \lambda = 0\\ a + \lambda = 0 \\ b + \lambda + \mu_c = 0 \\ \lambda + \mu_d = 0 \\ \lambda + \mu_e = 0 \end{align} $$ We find no contradiction. Note that $\mu_a = \mu_b = 0$ as these inequailities are inactive for $a, b > 0$.