# Lagrangian Multiplier for liner problem

I have a (probably) stupid question but I can't find the answer. I have the following problem (my problem is much more complicated but as an example) :

$$\begin{matrix} \displaystyle \min_{\substack{q_1,K}} & J= CK + \sum_{i=1}^{10} price(i)(q_1(i)+q_2(i)) \\ \textrm{s.t.} & q_1(i) + q_2(i) & \leq & K \\ \end{matrix} \label{Lagrangian_Multiplier}$$

So I have one fix storage cost, and then at each period I buy a quantity $q_1 + q_2$ at price $price(i)$. I need to choose the capacity of my storage and how much $q_1$ do I buy.

The lagrangian is $CK + \sum_{i=1}^{10} price(i)(q_1(i)+q_2(i)) - \lambda(q_1 + q_2 - K)$

\begin{equation*} \begin{aligned} & \frac{\partial J}{\partial q_1}(t)& = & \sum_{i=1}^{10} p(i) - \lambda \\ & \frac{\partial J}{\partial \lambda}(t)& = & - q_1(i) - q_2(i) + K \end{aligned} \end{equation*}

and those two derivatives have to be zero. That would mean that $\lambda$ (my shadow cost) is equal to the sum of all what I bought during the period 1 to 10 ? That does not seems right to me intuitively. I must confuse different notion. Can you explain me where I am wrong. My though are that the shadow price should be greater than zero only when q_1 + q_2 = K

Best.

Look at your equation $\frac{\partial J}{\partial \lambda} = 0$. This means that $q_1 + q_2 = K$. This is a constraint which you enforce on the problem (not $q_1 + q_2 \le K$ which is what you seem to want).