TITLE: integration with indicator function
QUESTION [6 upvotes]: I was trying to solve the following simple integration involving indicator function $I_{(a,b]}$ in a journal article. Here are the equations (in LaTeX notation):
$$
f(u) = \int_{0}^{1} (I_{(0,s]}(u) - s)\; ds\tag{1}
$$
$$
g(u,v) = \int_{0}^{1} (I_{(0,s]}(u) - s)(I_{(0,s]}(v) - s)\; ds\tag{2}
$$
where $0 < u, v < 1$. I was thinking that the integration will be simply just
$$
f(u) = \int_{0}^{1} (1 - s)\; ds\tag{1}
$$
$$  
g(u,v) = \int_{0}^{1} (1 - s)(1 - s)\; ds
\tag{2}
$$
But, I'm not so sure about this. The constraint on both $u$ and $v$ confused me. Any pointer to this solution?
Thanks
Wayan

REPLY [8 votes]: The integrals are functions of parameters, so I advise you to interchange the set and the variable in the indicator function: for a fixed $u$ we have
$$
I_{(0,s]}(u) = \begin{cases}
1,&\text{ if }0<u\leq s
\\
0,&\text{ otherwise}.
\end{cases}\Rightarrow  I_{(0,s]}(u)
 = I_{[u,\infty)}(s)
$$
where we also used that $u>0$. Hence
$$
f(u) = \int\limits_{0}^1(I_{(0,s]}(u) - s)ds = \int\limits_0^1(I_{[u,\infty)}(s) - s)ds = (1-u)-\int\limits_0^1 sds = \frac12-u
$$
and similar for the function $g$: when you open the brackets you get 4 terms - of which 3 you should know how to compute (they involve at most 1 indicator function) and for the last term you have:
$$
\int\limits_0^1I_{(0,s]}(u)\cdot I_{(0,s]}(v)ds = \int\limits_0^1I_{[u,\infty)}(s)I_{[v,\infty)}(s)ds = \int\limits_0^1I_{[\max(u,v),\infty)}(s)ds = 1-\max(u,v).
$$