The question is as follows:
Given $a,b,c,d > 0$ and integers, and that $a+b+c+d=40$ -- find the maximum value of $ab+bc+cd$
There is a way to answer this question without using calculus (I am aware of this) but I was wondering how I could apply the method of legrange multipliers? (I have only just learnt the concept)
My attempt gave me a maximum that was 1 off!
You take the partial derivatives of $f-\lambda g$ with respect to all variables, including $\lambda$, and set them equal to zero, where $f$ is the function to be maximized and $g$ is the constraint. The intuition is that this guarantees that $\nabla f$ and $\nabla g$ are parallel, so the function and the constraint are tangent, which must occur at any constrained extremum.
In this case we have $(ab + bc+ cd)-\lambda(a+b+c+d-40)$. Set the partial derivatives equal to zero and we have the equations $b-\lambda=0$, $a+c-\lambda=0$, $b+d-\lambda=0$, $c-\lambda=0$, and the constraint $a+b+c+d=40$.
The solution is $a=d=0$, and $b=c=20.$ the value of the function is 400.
I guess since you require the numbers to be positive, this solution is outside your domain. However this is the only solution you can get by Lagrange multipliers.