<p>The minimization problem
<span class="math-container">$$\min_{w(\cdot)}  \int^{\pi_{max}}_{\pi_{min}}w(\pi)f(\pi|e)d\pi$$</span>
s.t
<span class="math-container">$$\int^{\pi_{max}}_{\pi_{min}}v(w(\pi))f(\pi|e)d\pi-g(e) = \bar{u},$$</span>
is evidently an infinite dimensional optimization problem. The FOC, <em>a la</em> Lagrange, comes from standard consideration for such problems.</p>
<p>To make this more explicit, define the objective and constrain functionals <span class="math-container">$\Phi$</span> and <span class="math-container">$G$</span> (on an appropriate function space, say the Banach space <span class="math-container">$C[\pi_{min}, \pi_{max}]$</span>) by
<span class="math-container">$$
\Phi(w(\cdot)) =  \int^{\pi_{max}}_{\pi_{min}}w(\pi)f(\pi|e)d\pi
$$</span>
and
<span class="math-container">$$
G(w(\cdot)) = \bar{u} - \int^{\pi_{max}}_{\pi_{min}}v(w(\pi))f(\pi|e)d\pi + g(e). 
$$</span>
Then the problem is simply
<span class="math-container">$$
\min_{w(\cdot)} \Phi(w(\cdot)) \;\; s.t. \;\; G(w(\cdot)) = 0,
$$</span>
which is a standard sort of optimization problem over an infinite dimensional space.</p>
<p>The necessary Lagrangian FOC (as in the finite dimensional setting) would be
<span class="math-container">$$
D_{w} \Phi + \lambda D_{w} G = 0,
$$</span>
where <span class="math-container">$\lambda$</span> is the Lagrange multiplier.
Here, the appropriate notion of the derivative <span class="math-container">$D_{w}$</span> is the <a href="https://en.wikipedia.org/wiki/Differentiation_in_Fr%C3%A9chet_spaces" rel="nofollow noreferrer">Frechet derivative</a>.</p>
<p>In this specific case, <span class="math-container">$\Phi$</span> is a linear functional. Just as in the finite dimensional setting, the derivative of a linear functional is itself, i.e.
<span class="math-container">$$
D_{w} \Phi = f,
$$</span>
and, an integration by parts calculation would tell us
<span class="math-container">$$
D_{w} G = v'(w(\pi))f(\pi|e).
$$</span>
So one arrives at the FOC
<span class="math-container">$$
-f(\pi|e) + \gamma v'(w(\pi))f(\pi|e)=0.
$$</span></p>
<blockquote>
<p>...this situation ...happens often in microeconomics.</p>
</blockquote>
<p>By &quot;this&quot;, you mean &quot;solving&quot; such problems by differentiating under the integral sign then setting the integrand equal to identically zero.
Yes, this somewhat loose approach---with various accompanying hand-wavy justifications---often suffices in economic contexts.</p>

CC BY-SA 4.0
2020-10-20T04:33:51.837Z
2020-10-23T17:49:35.053Z
2020-10-23T17:49:35.053Z
Michael
<p>For taking a derivative under the integral, I find it helpful to consider the discrete analog, i.e. taking a derivative under summation.</p>
<p>Instead of having <span class="math-container">$\pi\in[\pi_{min},\pi_{max}]$</span>, suppose <span class="math-container">$\pi$</span> takes value from a discrete set <span class="math-container">$\{\pi_1,\pi_2,\dots,\pi_n\}$</span>. Then the problem becomes
<span class="math-container">\begin{equation}
\min_{w(\pi_i)}\sum_{i=1}^nw(\pi_i)f(\pi_i|e)\quad\text{s.t.}\quad \sum_{i=1}^nv(w(\pi_i))f(\pi_i|e)-g(e)\ge \bar u.
\end{equation}</span>
Now if you expand the summation in a Lagrangian, you'll get
<span class="math-container">\begin{multline}
\min_{w(\pi_i)}\quad w(\pi_1)f(\pi_1|e)+\cdots+w(\pi_i)f(\pi_i|e)+\cdots+w(\pi_n)f(\pi_n|e)\\
-\gamma\biggl[v(w(\pi_1))f(\pi_1|e)+\cdots+v(w(\pi_i))f(\pi_i|e)+\cdots+v(w(\pi_n))f(\pi_n|e)\biggr.\\
\biggl.-g(e)-\bar u\biggr]
\end{multline}</span>
From here, it should be obvious that the derivative with respect to <span class="math-container">$w(\pi_i)$</span> equals
<span class="math-container">\begin{equation}
f(\pi_i|e)-\gamma v'(w(\pi_i))f(\pi_i|e).
\end{equation}</span>
The expression in MWG is obtained by setting the above expression to <span class="math-container">$0$</span> and multiplying both sides by <span class="math-container">$-1$</span>.</p>

CC BY-SA 4.0
2020-10-19T16:29:49.583Z
+1 but shouldn't there be minus in front of lagrangian multiplier? I think that could explain why the final equation has minus in front of it - authors just mulitiply the whole expression by -1. If my memory serves right if constraint is solved as $g(x,y,z...)−c=0$ the multiplier would be negative (i.e. the lagrangian function would be $\mathcal{L} = f(x,y,z...)-\lambda(g(x,y,z...)−c)$  So the solution would be $f(\pi_i|e)-\gamma v'(w(\pi_i))f(\pi_i|e) = 0$ which is the same as $-f(\pi_i|e)+\gamma v'(w(\pi_i))f(\pi_i|e)=0$
1muflon1
CC BY-SA 4.0
2020-10-19T17:41:19.920Z
@1muflon1: Thanks. I edited my answer.
Herr K.
CC BY-SA 4.0
2020-10-20T04:20:56.310Z
thanks, Herr. that is what I was thinking about in terms of the discrete case. I was wondering why can we discretize the problem, but apparently, MWG noted it on a footnote.
Victor Dahan
CC BY-SA 4.0
2020-10-20T19:28:25.677Z
@VictorDahan: I think [Michael's answer](https://economics.stackexchange.com/a/40336/42) addresses your question in a rigorous manner.
Herr K.
CC BY-SA 4.0
2020-10-19T16:16:26.447Z
2020-10-19T17:41:15.193Z
2020-10-19T17:41:15.193Z
Herr K.
<p>The answer by user Herr K. is very sensible and in fact is what MWG p. 481 footnote 6 suggest to do in order to obtain the f.o.c.</p>
<p>But this approach begs the question: <em><strong>Then why on earth did we use the integrals in the first place, only to abandon them for the discrete formulation?</strong></em></p>
<p>If our problem is formulated in terms of continuous profits, then profits are a continuous random variable, and considering cases &quot;at each level of <span class="math-container">$\pi$</span> separately&quot; (as  MWG write in their footnote), <em>is not possible</em> because there are <em>uncountably infinite</em> &quot;levels of profit&quot;. MWG attempt to rectify this by writing in the same footnote</p>
<blockquote>
<p><em>To be rigorous, we should add that when we have a continuum of possible
levels  of <span class="math-container">$\pi$</span>, an optimal compensation scheme need only satisfy the
f.o.c at a set of profit levels that is of full measure.</em></p>
</blockquote>
<p>Now, one should tells us how we can obtain a &quot;set of full measure&quot; by including in it a finite number of points from a set that is uncountably infinite (the continuum, that is).</p>
<p>So, once more: why then formulate the problem in continuous terms, only to change the formulation to discrete in order to obtain the f.o.c? Why not formulate the problem in discrete terms from the beginning?</p>
<p>Moreover the description of the situation is</p>
<ol>
<li><span class="math-container">$\pi$</span> is a random variable</li>
<li><span class="math-container">$w$</span> is a function of <span class="math-container">$\pi$</span></li>
<li>We want to choose the optimal <span class="math-container">$w$</span></li>
</ol>
<p>But 2. means that <span class="math-container">$w$</span> is a random variable, so the only meaning 3. may have is that what we are going to choose is <span class="math-container">$w$</span> as a function of <span class="math-container">$\pi$</span>, not <span class="math-container">$w$</span> as a number. Because if we choose <span class="math-container">$w$</span> as a number, we essentially eliminate its dependence on the random variable <span class="math-container">$\pi$</span>...</p>
<p>...but this is exactly what we can do in order to arrive at the f.o.c. So, treat <span class="math-container">$w$</span> as a decision variable independent of <span class="math-container">$\pi$</span>. We want to</p>
<p><span class="math-container">$$\min_w \int_{\pi_{min}}^{\pi_{max}} w f(\pi\mid e)d\pi\,-\,\gamma \int_{\pi_{min}}^{\pi_{max}} v(w) f(\pi\mid e)d\pi\,.$$</span></p>
<p>Take the derivative with respect to <span class="math-container">$w$</span> and set it equal to zero:</p>
<p><span class="math-container">$$\int_{\pi_{min}}^{\pi_{max}} f(\pi\mid e)d\pi\,-\,\gamma \int_{\pi_{min}}^{\pi_{max}} v'(w) f(\pi\mid e)d\pi = 0.$$</span></p>
<p>Because we treat <span class="math-container">$w$</span> as a decision variable independent of <span class="math-container">$\pi$</span>, we can take it out of the integral,</p>
<p><span class="math-container">$$\int_{\pi_{min}}^{\pi_{max}} f(\pi\mid e)d\pi\,-\,\gamma v'(w)\int_{\pi_{min}}^{\pi_{max}} f(\pi\mid e)d\pi = 0.$$</span></p>
<p>Both integrals now equal unity, since <span class="math-container">$f(\pi\mid e)$</span> is a proper density over the specific domain, so we end up with</p>
<p><span class="math-container">$$1\,-\,\gamma v'(w) = 0 \implies \gamma = \frac{1}{v'(w)},$$</span></p>
<p>...which is exactly the solution one can find in MWG p. 481. So this f.o.c corresponds also to describing an optimization problem where <span class="math-container">$w$</span> is presented initially as a function of <span class="math-container">$\pi$</span>, and then to solving the problem by treating <span class="math-container">$w$</span> as not being a function of <span class="math-container">$\pi$</span>.</p>
<p>To recapitulate:</p>
<ol>
<li><p>We formulated a problem over the continuum, and where the decision
variable is a function of a random variable.</p>
</li>
<li><p>In order to arrive at the f.o.c we either<br />
a) Abandon the continuum formulation and look at a discrete version or<br />
b) Abandon the assumption that the decision variable is a function
of a random variable</p>
</li>
</ol>
<p>This rather twisted situation deserves some contemplation from the side of any interested reader, and I will leave them to it. See also <a href="https://economics.stackexchange.com/a/231/61">https://economics.stackexchange.com/a/231/61</a>.</p>

CC BY-SA 4.0
2020-10-20T04:24:55.687Z
Thanks, Alecos, this is a quite interesting point of view. Actually, it feels like the problem can't be analytically solved without dropping one of these two assumptions.
Victor Dahan
CC BY-SA 4.0
2020-10-20T08:07:38.017Z
@VictorDahan There is hope. See an old post of mine, here, https://economics.stackexchange.com/a/231/61
Alecos Papadopoulos
CC BY-SA 4.0
2020-10-20T02:15:14.923Z
2020-10-23T13:58:30.663Z
2020-10-23T13:58:30.663Z
Alecos Papadopoulos
<p>For a wage as a function of profit: <span class="math-container">$w(\pi)$</span> and profit <span class="math-container">$\pi \in [\pi_{min},\pi_{max}]$</span>, the owner of a company sets the minimum wage to satisfy the following condition:</p>
<p>obs <span class="math-container">$e = \{e_l, e_h\}$</span> but in this case effort is observable and contractible, and <span class="math-container">$f(\pi|e)$</span> is the pdf of <span class="math-container">$\pi$</span>, thus:</p>
<p><span class="math-container">$$\min_{w(\pi)}  \int^{\pi_{max}}_{\pi_{min}}w(\pi)f(\pi|e)d\pi$$</span>
subject to manager's participation condition:
<span class="math-container">$$\int^{\pi_{max}}_{\pi_{min}}v(w(\pi))f(\pi|e)d\pi-g(e) = \bar{u}$$</span>
after doing a lagrange optimization F.O.C
<span class="math-container">$$-f(\pi|e) + \gamma v'(w(\pi))f(\pi|e)=0$$</span></p>
<p><strong>What exactly I do not understand is how the author took the derivative of the integrand and disappeared with the integral signs... why does it work?</strong></p>
<p>edit: Just in case, you can find this situation in MWG page 480-481, but it happens often in microeconomics.</p>

CC BY-SA 4.0
2020-10-19T10:34:55.163Z
derivative and integral cancel each other out
WilliamT
CC BY-SA 4.0
2020-10-19T15:31:22.197Z
I can see that, but the author took the derivative of the inside too...
Victor Dahan
<microeconomics><mathematical-economics>
Derivative of definite integrals - how did MWG arrived at this result? Microeconomics
Victor Dahan
# Derivative of definite integrals - how did MWG arrived at this result? Microeconomics

(Asked by: username_0 on 2020-10-19)

For a wage as a function of profit: $w(\pi)$ and profit $\pi \in [\pi\_{min},\pi\_{max}]$, the owner of a company sets the minimum wage to satisfy the following condition:

obs $e = \{e\_l, e\_h\}$ but in this case effort is observable and contractible, and $f(\pi|e)$ is the pdf of $\pi$, thus:

$$\min\_{w(\pi)} \int^{\pi\_{max}}\_{\pi\_{min}}w(\pi)f(\pi|e)d\pi$$
subject to manager's participation condition:
$$\int^{\pi\_{max}}\_{\pi\_{min}}v(w(\pi))f(\pi|e)d\pi-g(e) = \bar{u}$$
after doing a lagrange optimization F.O.C
$$-f(\pi|e) + \gamma v'(w(\pi))f(\pi|e)=0$$

**What exactly I do not understand is how the author took the derivative of the integrand and disappeared with the integral signs... why does it work?**

edit: Just in case, you can find this situation in MWG page 480-481, but it happens often in microeconomics.

**Tags:** microeconomics, mathematical-economics

> **Comments:**
> **username_1**: derivative and integral cancel each other out  
> **username_0**: I can see that, but the author took the derivative of the inside too...  

---

## 3 answers

### Answer by username_2 on 2020-10-20. Score: 10

The minimization problem
$$\min\_{w(\cdot)} \int^{\pi\_{max}}\_{\pi\_{min}}w(\pi)f(\pi|e)d\pi$$
s.t
$$\int^{\pi\_{max}}\_{\pi\_{min}}v(w(\pi))f(\pi|e)d\pi-g(e) = \bar{u},$$
is evidently an infinite dimensional optimization problem. The FOC, *a la* Lagrange, comes from standard consideration for such problems.

To make this more explicit, define the objective and constrain functionals $\Phi$ and $G$ (on an appropriate function space, say the Banach space $C[\pi\_{min}, \pi\_{max}]$) by
$$
\Phi(w(\cdot)) = \int^{\pi\_{max}}\_{\pi\_{min}}w(\pi)f(\pi|e)d\pi
$$
and
$$
G(w(\cdot)) = \bar{u} - \int^{\pi\_{max}}\_{\pi\_{min}}v(w(\pi))f(\pi|e)d\pi + g(e).
$$
Then the problem is simply
$$
\min\_{w(\cdot)} \Phi(w(\cdot)) \;\; s.t. \;\; G(w(\cdot)) = 0,
$$
which is a standard sort of optimization problem over an infinite dimensional space.

The necessary Lagrangian FOC (as in the finite dimensional setting) would be
$$
D\_{w} \Phi + \lambda D\_{w} G = 0,
$$
where $\lambda$ is the Lagrange multiplier.
Here, the appropriate notion of the derivative $D\_{w}$ is the [Frechet derivative](https://en.wikipedia.org/wiki/Differentiation_in_Fr%C3%A9chet_spaces).

In this specific case, $\Phi$ is a linear functional. Just as in the finite dimensional setting, the derivative of a linear functional is itself, i.e.
$$
D\_{w} \Phi = f,
$$
and, an integration by parts calculation would tell us
$$
D\_{w} G = v'(w(\pi))f(\pi|e).
$$
So one arrives at the FOC
$$
-f(\pi|e) + \gamma v'(w(\pi))f(\pi|e)=0.
$$

> ...this situation ...happens often in microeconomics.

By "this", you mean "solving" such problems by differentiating under the integral sign then setting the integrand equal to identically zero.
Yes, this somewhat loose approach---with various accompanying hand-wavy justifications---often suffices in economic contexts.


---

### Answer by username_3 on 2020-10-19. Score: 9

For taking a derivative under the integral, I find it helpful to consider the discrete analog, i.e. taking a derivative under summation.

Instead of having $\pi\in[\pi\_{min},\pi\_{max}]$, suppose $\pi$ takes value from a discrete set $\{\pi\_1,\pi\_2,\dots,\pi\_n\}$. Then the problem becomes
\begin{equation}
\min\_{w(\pi\_i)}\sum\_{i=1}^nw(\pi\_i)f(\pi\_i|e)\quad\text{s.t.}\quad \sum\_{i=1}^nv(w(\pi\_i))f(\pi\_i|e)-g(e)\ge \bar u.
\end{equation}
Now if you expand the summation in a Lagrangian, you'll get
\begin{multline}
\min\_{w(\pi\_i)}\quad w(\pi\_1)f(\pi\_1|e)+\cdots+w(\pi\_i)f(\pi\_i|e)+\cdots+w(\pi\_n)f(\pi\_n|e)\\
-\gamma\biggl[v(w(\pi\_1))f(\pi\_1|e)+\cdots+v(w(\pi\_i))f(\pi\_i|e)+\cdots+v(w(\pi\_n))f(\pi\_n|e)\biggr.\\
\biggl.-g(e)-\bar u\biggr]
\end{multline}
From here, it should be obvious that the derivative with respect to $w(\pi\_i)$ equals
\begin{equation}
f(\pi\_i|e)-\gamma v'(w(\pi\_i))f(\pi\_i|e).
\end{equation}
The expression in MWG is obtained by setting the above expression to $0$ and multiplying both sides by $-1$.

> **Comments:**
> **username_4**: +1 but shouldn't there be minus in front of lagrangian multiplier? I think that could explain why the final equation has minus in front of it - authors just mulitiply the whole expression by -1. If my memory serves right if constraint is solved as $g(x,y,z...)−c=0$ the multiplier would be negative (i.e. the lagrangian function would be $\mathcal{L} = f(x,y,z...)-\lambda(g(x,y,z...)−c)$  So the solution would be $f(\pi_i|e)-\gamma v'(w(\pi_i))f(\pi_i|e) = 0$ which is the same as $-f(\pi_i|e)+\gamma v'(w(\pi_i))f(\pi_i|e)=0$  
> **username_3**: @username_4: Thanks. I edited my answer.  
> **username_0**: thanks, username_3. that is what I was thinking about in terms of the discrete case. I was wondering why can we discretize the problem, but apparently, MWG noted it on a footnote.  
> **username_3**: @username_0: I think [username_2's answer](https://economics.stackexchange.com/a/40336/42) addresses your question in a rigorous manner.  

---

### Answer by username_5 on 2020-10-20. Score: 8

The answer by user username_3. is very sensible and in fact is what MWG p. 481 footnote 6 suggest to do in order to obtain the f.o.c.

But this approach begs the question: ***Then why on earth did we use the integrals in the first place, only to abandon them for the discrete formulation?***

If our problem is formulated in terms of continuous profits, then profits are a continuous random variable, and considering cases "at each level of $\pi$ separately" (as MWG write in their footnote), *is not possible* because there are *uncountably infinite* "levels of profit". MWG attempt to rectify this by writing in the same footnote

> *To be rigorous, we should add that when we have a continuum of possible
> levels of $\pi$, an optimal compensation scheme need only satisfy the
> f.o.c at a set of profit levels that is of full measure.*

Now, one should tells us how we can obtain a "set of full measure" by including in it a finite number of points from a set that is uncountably infinite (the continuum, that is).

So, once more: why then formulate the problem in continuous terms, only to change the formulation to discrete in order to obtain the f.o.c? Why not formulate the problem in discrete terms from the beginning?

Moreover the description of the situation is

1. $\pi$ is a random variable
2. $w$ is a function of $\pi$
3. We want to choose the optimal $w$

But 2. means that $w$ is a random variable, so the only meaning 3. may have is that what we are going to choose is $w$ as a function of $\pi$, not $w$ as a number. Because if we choose $w$ as a number, we essentially eliminate its dependence on the random variable $\pi$...

...but this is exactly what we can do in order to arrive at the f.o.c. So, treat $w$ as a decision variable independent of $\pi$. We want to

$$\min\_w \int\_{\pi\_{min}}^{\pi\_{max}} w f(\pi\mid e)d\pi\,-\,\gamma \int\_{\pi\_{min}}^{\pi\_{max}} v(w) f(\pi\mid e)d\pi\,.$$

Take the derivative with respect to $w$ and set it equal to zero:

$$\int\_{\pi\_{min}}^{\pi\_{max}} f(\pi\mid e)d\pi\,-\,\gamma \int\_{\pi\_{min}}^{\pi\_{max}} v'(w) f(\pi\mid e)d\pi = 0.$$

Because we treat $w$ as a decision variable independent of $\pi$, we can take it out of the integral,

$$\int\_{\pi\_{min}}^{\pi\_{max}} f(\pi\mid e)d\pi\,-\,\gamma v'(w)\int\_{\pi\_{min}}^{\pi\_{max}} f(\pi\mid e)d\pi = 0.$$

Both integrals now equal unity, since $f(\pi\mid e)$ is a proper density over the specific domain, so we end up with

$$1\,-\,\gamma v'(w) = 0 \implies \gamma = \frac{1}{v'(w)},$$

...which is exactly the solution one can find in MWG p. 481. So this f.o.c corresponds also to describing an optimization problem where $w$ is presented initially as a function of $\pi$, and then to solving the problem by treating $w$ as not being a function of $\pi$.

To recapitulate:

1. We formulated a problem over the continuum, and where the decision
   variable is a function of a random variable.
2. In order to arrive at the f.o.c we either  
   a) Abandon the continuum formulation and look at a discrete version or  
   b) Abandon the assumption that the decision variable is a function
   of a random variable

This rather twisted situation deserves some contemplation from the side of any interested reader, and I will leave them to it. See also <https://economics.stackexchange.com/a/231/61>.

> **Comments:**
> **username_0**: Thanks, username_5, this is a quite interesting point of view. Actually, it feels like the problem can't be analytically solved without dropping one of these two assumptions.  
> **username_5**: @username_0 There is hope. See an old post of mine, here, https://economics.stackexchange.com/a/231/61  

---

