Problem (Rudin, R&CA chapter 2, no. 25)
(i) Find the smallest positive constant $c$ such that $$ \log(1+e^t) \le c+t , \qquad t \in (0,+\infty). $$
(ii) Does $$ \lim_{n \to+\infty} \frac{1}{n}\int_0^1 \log(1+e^{nf(x)})\,dx $$ exist for every $f \in L^1$? If it exists what is it?
Part (i) can be solved in an elementary way, for instance noticing that the function $t \mapsto \log(1+e^t)-t$ is decreasing on $(0,+\infty)$ hence its maximum is attained in $0$ and is precisely $\log 2$.
The second question is more interesting: I have set $X^+:=\{f \ge 0\}$ and $X^-=[0,1] \setminus X^+$, hence $$ \frac{1}{n}\int_0^1 \log(1+e^{nf(x)})\,dx = \frac{1}{n}\int_{X^+} \log(1+e^{nf(x)})\,dx + \frac{1}{n}\int_{X^-} \log(1+e^{nf(x)})\,dx =: I_1 + I_2 $$
The first term $I_1$ can be treated using inequality above $$ I_1 \le \frac{1}{n}\left(\log 2\mathscr |X^+| + n \int_{X^+}f(x)dx\right) \to \int_{X^+}f(x)dx $$ as $n \to +\infty$. On the other hand, $I_2$ can be computed using dominated convergence theorem, since on $X^-$ we have $f<0$ hence $$ \frac{1}{n}\log(1+e^{nf(x)}) \le 1 \log{1+1} = \log 2, \qquad \forall n. $$ In particular, we have $\frac{1}{n}\log(1+e^{nf(x)}) \to 0$ for every $x \in X^-$ so we deduce $I_2 \to 0$.
In conclusion, the limit always exists and it is equal to $\int_{X^+} f$, or which is the same, $\int_0^1 f^+$.
Is this correct? Thanks in advance.
It is well written and globally correct. The unique minor point is that you showed that $\limsup_nI_1\leqslant \int_{X^+}f(x)\mathrm dx$ and actually we want to show that the RHS is the limit. You can use the dominated convergence theorem thanks to the inequality obtained in (i).