<p>I add to the great answer of tdm some specifications about the term <em><strong>for almost all</strong></em>, because it is very important in mathematical analysis and in probability theory, and it is very likely to find it in texts or papers.
<span class="math-container">$$\;$$</span></p>
<blockquote>
<p>why is the qualification necessary &quot;for almost all&quot;.</p>
</blockquote>
<p><em><strong>for almost all</strong></em> in mathematics means the same as <em><strong>almost everywhere</strong></em> (usually abbreviated as <strong>a.e.</strong>).</p>
<p>This is a concept that relates to <em><strong>measure theory</strong></em>.
Measure theory is a branch of mathematics which, roughly speaking, has the aim of establishing the 'extension' of a set, you may think it as a generalization of the concept of area or of length of a segment.</p>
<p>Measure theory defines on some subsets a function, a <a href="https://en.wikipedia.org/wiki/Measure_(mathematics)" rel="nofollow noreferrer"><em><strong>measure</strong></em></a>, which assigns to the subsets a real number or <span class="math-container">$+\infty$</span>, (that is an element of the <em>extended real line</em>).</p>
<p>Formally, a (real) <em>measure <em>m</em></em> is defined as a <em>set function</em> as</p>
<p><span class="math-container">$$ m: \Omega \rightarrow [0, +\infty]$$</span>
where <span class="math-container">$\Omega$</span> is usually a so-called <em>sigma-algebra</em> of subsets, such that <span class="math-container">$m(\emptyset)=0$</span>, and the function <span class="math-container">$m$</span> has the property of <em>sigma-additivity</em>.
<span class="math-container">$$\;$$</span></p>
<p>The term <a href="https://en.wikipedia.org/wiki/Almost_everywhere" rel="nofollow noreferrer"><em>almost everywhere</em></a>
defines a property that is defined on a set, except on a subset of <em><strong>zero measure</strong></em>. More formally:</p>
<p><em>For a measurable set <span class="math-container">$E$</span>, we say that a property holds <strong>almost everywhere on <span class="math-container">$E$</span></strong>, or it holds for almost all <span class="math-container">$x\in E$</span>, provided that there is a subset <span class="math-container">$E_0$</span> of <span class="math-container">$E$</span> for which <span class="math-container">$m(E_0)=0$</span> and the property holds for all <span class="math-container">$x\in E   \sim E_0$</span>.<span class="math-container">$^1$</span></em></p>
<p>For instance,  equalities between mathematical entities can be defined <em>almost everywhere</em>, meaning that they are equal except over a subset of zero measure: two functions can be equal <em>a.e.</em>,  and this kind of equality is very important in real analysis. It is a part of the theory of measure necessary to build the <em><strong>Lebesgue integral</strong></em>, which is a more general concept of integral with respect to <em><strong>Riemann integral</strong></em>.</p>
<p>There are many types of measures.  Usually, when not otherwise specified, one refers to <a href="https://en.wikipedia.org/wiki/Lebesgue_measure" rel="nofollow noreferrer"><em><strong>Lebesgue measure</strong></em></a>.</p>
<p>There are many important results of mathematical analysis linked to sets of zero measure. One of the most  important is the</p>
<p><em><strong>Theorem</strong></em> (<strong>Lebesgue</strong>) <em>Let <span class="math-container">$f$</span> be a bounded function on the closed, bounded interval <span class="math-container">$[a,b]$</span>.Then <span class="math-container">$f$</span> is Riemann integrable over [a,b]
if and only if the set of the points in [a,b] at which <span class="math-container">$f$</span> fails to be continuous has measure zero.</em><span class="math-container">$^2$</span></p>
<p><span class="math-container">$$\;$$</span></p>
<p>Theory of measure is used in <strong>probability theory</strong>, sometimes probability theory is considered a part of measure theory.<span class="math-container">$^3$</span></p>
<p>I cannot read the article you mentioned, but I suppose that it uses theory of measure and Lebesgue integral.</p>
<hr />
<p><span class="math-container">$^1$</span> <sup> Royden H. L., Fitzpatrick P. M.,  <em>Real Analysis</em>, Prentice Hall, 2010, p. 45. the sign <span class="math-container">$\sim$</span> here is the <em>set difference</em>.</sup></p>
<p><span class="math-container">$^2$</span> <sup> <em>Ibid.</em> p. 104. Don't think <em>of zero measure</em> as a synonymous of <em>small</em>, for instance in the sense of cardinality of a set. Infinite sets also can be  of measure zero:  an infinitely countable set has  measure zero. </sup></p>
<p><span class="math-container">$^3$</span> <sup>A standard reference is Billingsley, <em>Probability and Measure</em>, Wiley, 1995.</sup></p>

CC BY-SA 4.0
2023-08-16T16:56:15.253Z
2023-08-16T16:56:15.253Z
BakerStreet
<p>The fact that
<span class="math-container">$$
\frac{g_{a_i}(y,a)}{g(y,a)},
$$</span>
is the same for all <span class="math-container">$y$</span> for which <span class="math-container">$T_i(y) = T_i$</span> implies that the fraction can be written as a function of the value of <span class="math-container">$T_i(y)$</span> and <span class="math-container">$a$</span> alone.</p>
<p>So there is some function <span class="math-container">$P_i(T_i(y),a)$</span> such that:
<span class="math-container">$$
\frac{g_{a_i}(y,a)}{g(y,a)} = P_i(T_i(y),a).
$$</span>
Now the left hand side equals the derivative of <span class="math-container">$\ln(g(y,a))$</span> with respect to <span class="math-container">$a_i$</span>, so
<span class="math-container">$$
\frac{\partial \ln(g(y,a))}{\partial a_i} = P_i(T_i(y),a).
$$</span>
We can integrate both sides with respect to <span class="math-container">$a_i$</span>,
<span class="math-container">$$
\ln(g(y,a)) = K_i(T_i(a),a) + C_i(y,a_{-i}),
$$</span>
where <span class="math-container">$K_i(T_i(y),a) = \int P_i(T_i(y),a) d a_i$</span> and where <span class="math-container">$C_i(y,a_{-i})$</span> is the constant of integration, which can depend on both <span class="math-container">$y$</span> and <span class="math-container">$a_{-i}$</span> (but not on <span class="math-container">$a_i$</span> as this is the variable you are integrating over). So,
<span class="math-container">$$
g(y,a) = e^{K_i(T_i(y),a)} e^{C_i(y,a_{-i})}.
$$</span>
Now denote <span class="math-container">$p_i(T_i(y),a) = e^{K_i(T_i(y),a)}$</span> and <span class="math-container">$h_i(y,a_{-i}) = e^{C_i(y,a_{-i})}$</span> to get to the result.</p>

CC BY-SA 4.0
2023-08-16T12:28:34.683Z
Thanks a lot! I think you forgot to write $e^{ln(g(y,a))}=g(y,a)$ in the last equation. Do you have an idea why the qualification "for almost all" is necessary ?
contracttheory
CC BY-SA 4.0
2023-08-16T13:08:04.777Z
Thanks, corrected it. The for all, means (I think) that the condition can be violated on a set of measure zero. This set will not impact the shape of the density function.
tdm
CC BY-SA 4.0
2023-08-16T11:12:10.883Z
2023-08-16T13:05:15.037Z
2023-08-16T13:05:15.037Z
tdm
<p>I have a few mathematical problems with the paper Moral hazard in teams 1982. How do I get from (2) to (1) by integrating and why is the qualification necessary &quot;for almost all&quot;</p>
<p><span class="math-container">$$g(y,a)=h_i(y,a_{-i})*p_i(T_i(y),a) \qquad (1) $$</span></p>
<p><span class="math-container">$$\frac{g_{ai}(y_1,a)}{g(y_1,a)}=\frac{g_{ai}(y_2,a)}{g(y_2,a)} \qquad \text{for almost all} ~ y_1,y_2 \in \{y \vert T_i(y)=T_i  \}  \qquad (2) $$</span></p>
<p>How to integrate (2) to get (1) or how to use the partial derivative to get from (1) to (2)?</p>
<p>Thank you in advance and sorry for my bad english. i am not a native speaker. if there are any ambiguities with the question please let me know :)</p>

CC BY-SA 4.0
2023-08-16T07:00:07.817Z
In (1) the function's name is $g$. What is $g_{ai}$ ? Is it a second derivative wrt $a$ and $y_i$? Who are the authors of the paper, or what is the exact reference of the paper?
Bertrand
CC BY-SA 4.0
2023-08-16T09:34:14.960Z
The distribution of y as a function of a is given by $G(y, a)$ , with density $g(y, a)$. assumed that the derivative of $ g$ with respect to $ai$, 
denoted $g_{ai}$ exists for all {i}. reference: Holmstrom, B. (1982). Moral hazard in teams. The Bell journal of economics, 324-340.
contracttheory
CC BY-SA 4.0
2023-08-16T09:49:08.467Z
Could the following approach be correct:
$$g(y,a)=h(y,a_{-i})p(T(y),a) \\ \rightarrow
\ln(g(y,a))=\ln (h(y,a_{-i}) \cdot p(T(y),a)) \\ \rightarrow
\ln(g(y,a))=\ln (h(y,a_{-i}))+ \ln (p(T(y),a))$$
derivative wrt $a_i$: 
$$\frac{g_{ai}(y,a)}{g(y,a)}=\frac{p_{ai}(T(y),a)}{p(T(y),a)}$$
contracttheory
<mathematical-economics><principal-agent><contract-theory>
Integrate a sufficient statistic
contracttheory
# Integrate a sufficient statistic

(Asked by: username_0 on 2023-08-15)

I have a few mathematical problems with the paper Moral hazard in teams 1982. How do I get from (2) to (1) by integrating and why is the qualification necessary "for almost all"

$$g(y,a)=h\_i(y,a\_{-i})\*p\_i(T\_i(y),a) \qquad (1) $$

$$\frac{g\_{ai}(y\_1,a)}{g(y\_1,a)}=\frac{g\_{ai}(y\_2,a)}{g(y\_2,a)} \qquad \text{for almost all} ~ y\_1,y\_2 \in \{y \vert T\_i(y)=T\_i \} \qquad (2) $$

How to integrate (2) to get (1) or how to use the partial derivative to get from (1) to (2)?

Thank you in advance and sorry for my bad english. i am not a native speaker. if there are any ambiguities with the question please let me know :)

**Tags:** mathematical-economics, principal-agent, contract-theory

> **Comments:**
> **username_1**: In (1) the function's name is $g$. What is $g_{ai}$ ? Is it a second derivative wrt $a$ and $y_i$? Who are the authors of the paper, or what is the exact reference of the paper?  
> **username_0**: The distribution of y as a function of a is given by $G(y, a)$ , with density $g(y, a)$. assumed that the derivative of $ g$ with respect to $ai$,  denoted $g_{ai}$ exists for all {i}. reference: Holmstrom, B. (1982). Moral hazard in teams. The Bell journal of economics, 324-340.  
> **username_0**: Could the following approach be correct: $$g(y,a)=h(y,a_{-i})p(T(y),a) \\ \rightarrow \ln(g(y,a))=\ln (h(y,a_{-i}) \cdot p(T(y),a)) \\ \rightarrow \ln(g(y,a))=\ln (h(y,a_{-i}))+ \ln (p(T(y),a))$$ derivative wrt $a_i$:  $$\frac{g_{ai}(y,a)}{g(y,a)}=\frac{p_{ai}(T(y),a)}{p(T(y),a)}$$  

---

## 2 answers

### Answer by username_3 on 2023-08-16. Score: 4 | Accepted answer

The fact that
$$
\frac{g\_{a\_i}(y,a)}{g(y,a)},
$$
is the same for all $y$ for which $T\_i(y) = T\_i$ implies that the fraction can be written as a function of the value of $T\_i(y)$ and $a$ alone.

So there is some function $P\_i(T\_i(y),a)$ such that:
$$
\frac{g\_{a\_i}(y,a)}{g(y,a)} = P\_i(T\_i(y),a).
$$
Now the left hand side equals the derivative of $\ln(g(y,a))$ with respect to $a\_i$, so
$$
\frac{\partial \ln(g(y,a))}{\partial a\_i} = P\_i(T\_i(y),a).
$$
We can integrate both sides with respect to $a\_i$,
$$
\ln(g(y,a)) = K\_i(T\_i(a),a) + C\_i(y,a\_{-i}),
$$
where $K\_i(T\_i(y),a) = \int P\_i(T\_i(y),a) d a\_i$ and where $C\_i(y,a\_{-i})$ is the constant of integration, which can depend on both $y$ and $a\_{-i}$ (but not on $a\_i$ as this is the variable you are integrating over). So,
$$
g(y,a) = e^{K\_i(T\_i(y),a)} e^{C\_i(y,a\_{-i})}.
$$
Now denote $p\_i(T\_i(y),a) = e^{K\_i(T\_i(y),a)}$ and $h\_i(y,a\_{-i}) = e^{C\_i(y,a\_{-i})}$ to get to the result.

> **Comments:**
> **username_0**: Thanks a lot! I think you forgot to write $e^{ln(g(y,a))}=g(y,a)$ in the last equation. Do you have an idea why the qualification "for almost all" is necessary ?  
> **username_3**: Thanks, corrected it. The for all, means (I think) that the condition can be violated on a set of measure zero. This set will not impact the shape of the density function.  

---

### Answer by username_2 on 2023-08-16. Score: 2

I add to the great answer of tdm some specifications about the term ***for almost all***, because it is very important in mathematical analysis and in probability theory, and it is very likely to find it in texts or papers.
$$\;$$

> why is the qualification necessary "for almost all".

***for almost all*** in mathematics means the same as ***almost everywhere*** (usually abbreviated as **a.e.**).

This is a concept that relates to ***measure theory***.
Measure theory is a branch of mathematics which, roughly speaking, has the aim of establishing the 'extension' of a set, you may think it as a generalization of the concept of area or of length of a segment.

Measure theory defines on some subsets a function, a [***measure***](https://en.wikipedia.org/wiki/Measure_(mathematics)), which assigns to the subsets a real number or $+\infty$, (that is an element of the *extended real line*).

Formally, a (real) *measure *m** is defined as a *set function* as

$$ m: \Omega \rightarrow [0, +\infty]$$
where $\Omega$ is usually a so-called *sigma-algebra* of subsets, such that $m(\emptyset)=0$, and the function $m$ has the property of *sigma-additivity*.
$$\;$$

The term [*almost everywhere*](https://en.wikipedia.org/wiki/Almost_everywhere)
defines a property that is defined on a set, except on a subset of ***zero measure***. More formally:

*For a measurable set $E$, we say that a property holds **almost everywhere on $E$**, or it holds for almost all $x\in E$, provided that there is a subset $E\_0$ of $E$ for which $m(E\_0)=0$ and the property holds for all $x\in E \sim E\_0$.$^1$*

For instance, equalities between mathematical entities can be defined *almost everywhere*, meaning that they are equal except over a subset of zero measure: two functions can be equal *a.e.*, and this kind of equality is very important in real analysis. It is a part of the theory of measure necessary to build the ***Lebesgue integral***, which is a more general concept of integral with respect to ***Riemann integral***.

There are many types of measures. Usually, when not otherwise specified, one refers to [***Lebesgue measure***](https://en.wikipedia.org/wiki/Lebesgue_measure).

There are many important results of mathematical analysis linked to sets of zero measure. One of the most important is the

***Theorem*** (**Lebesgue**) *Let $f$ be a bounded function on the closed, bounded interval $[a,b]$.Then $f$ is Riemann integrable over [a,b]
if and only if the set of the points in [a,b] at which $f$ fails to be continuous has measure zero.*$^2$

$$\;$$

Theory of measure is used in **probability theory**, sometimes probability theory is considered a part of measure theory.$^3$

I cannot read the article you mentioned, but I suppose that it uses theory of measure and Lebesgue integral.

---

$^1$  Royden H. L., Fitzpatrick P. M., *Real Analysis*, Prentice Hall, 2010, p. 45. the sign $\sim$ here is the *set difference*.

$^2$  *Ibid.* p. 104. Don't think *of zero measure* as a synonymous of *small*, for instance in the sense of cardinality of a set. Infinite sets also can be of measure zero: an infinitely countable set has measure zero.

$^3$ A standard reference is Billingsley, *Probability and Measure*, Wiley, 1995.


---

