Gaining an intuition on a multi-variable calculus/optimisation problem Mathematics,
This is my first ever question so please let me know if I have conducted myself incorrectly in posting in this forum. 
I have a question related to multivariable calculus which I have solved, as follows. Given:
$$f(M,W)=kM(1+pW)$$
$$\frac{\partial f}{\partial M}=k(1+pW), \frac{\partial f}{\partial W}=kpM$$
$$condition \frac{\partial f}{\partial M}= \frac{\partial f}{\partial W}$$
$$k(1+pW)=kpM$$
$$M=W+ \frac{1}{p}$$
The result finds the ratio between $M, W$ that maximizes the function for each summed amount $M+W$, such that $M+W=Q$. For example:
$k=1, p=1, f(M,W) = M(1+W)$
Take $Q = 11$, arbitrarily choose $M=4, W=7$ such that $M+W=Q$
Therefore $f(4,7)=4(1+7)= 32$
Now using solution found earlier:
$M+W=11, M=W+1$ (earlier result), $\therefore M=6, W=5$. 
$f(6,5) = 6(1+5) = 36$, which is greater than $f(4,7)$ and all other combinations of $M, W$ such that $M+W=11$.
Another way to state this is to say for each increment of $Q$, what amount of $M$ and $W$ combined will produce the greatest value of the function $f (M, W)$. 
I have confirmed this using Microsoft Excel for values of M, W up to 100. I am unable to discern why equating the partial differentials produces this optimized result.
This condition might not even be correct to use and has been coincidentally stumbled upon; hopefully not the case but would like clarification. Thanks.
 A: Your excel approach is correct, that is why you are getting the correct result. The formal approach is applying the Lagrange Multipliers or the Karush Kuhn Tucker conditions. Basically is nullifying the sum of all the gradients of the objective and constraints together, including proper positive (or zero if possible) multipliers. If no constraints, you only equal the gradient to zero. 
The neccesary condition is:
$$
-\nabla f + \lambda \nabla g = 0
$$
keeping the constraints $g=0$ and everything positive $M,W,\lambda \ge 0$.
Thus:
$$
\text{max} \ f(M,W)=kM(1+pW)\\
 g(M,W)=M+W-Q=0
$$
$$
-{\partial f \over \partial M}+ \lambda {\partial g \over \partial M}=-k(1+pW)+\lambda=0\\
-{\partial f \over \partial W}+ \lambda{\partial g \over \partial W}=-kpM+\lambda=0 \\
g = M+W-Q=0
$$
From here:
$$
W={\lambda \over kp}-{1 \over p}\\
M={\lambda \over kp}\\
{\lambda \over kp}+{1 \over p}+{\lambda \over kp}=Q\\
\lambda=\frac{kp}2(Q-\frac 1p)
$$
Finally:
$$
W=\frac Q2 -\frac 1{2p}\\
M=\frac Q2 +\frac 1{2p}\\
$$
For $k=1,p=1,Q=11$, $W=5,M=6$ with $f=36$
A: Assume that you have momentarily settled for a point $(M,W)$ satisfying the condition $M+W=Q$. But you are not utterly convinced and therefore try for a nearby admissible point $(M+\delta, W-\delta)$. This nearby point would lead to
$$\eqalign{f(M+\delta, W-\delta)&=f(M,W)+ {\partial f\over\partial M}\delta+{\partial f\over\partial W}(-\delta)+o(\delta)\cr &=f(M,W)+\left({\partial f\over\partial M}-{\partial f\over\partial W}+o(1)\right)\delta\qquad(\delta\to0)\ .\cr}$$
If ${\partial f\over\partial M}-{\partial f\over\partial W}\ne0$ here you could increase $f$ in an admissible way by choosing a small $\delta\ne0$ of suitable sign.
It follows that at an optimal admissible point $(M,W)$ one necessarily has ${\partial f\over\partial M}={\partial f\over\partial W}$, as claimed in your recipe.
A general treatment of situations of this kind would lead to the method of Lagrange multiplyers.
