I recently dealt with this interesting exercise from Rudin's book "Real & Complex Analysis" and I would like to share & discuss my solution. All comments are welcome and if anyone has an alternate solution, please share it. The exercise is the following:
Let $f$ be a continuous function on $\mathbb{R}$, such that $f(x)>0$ on $(0,1)$ and $f(x)=0$ elsewhere. For $c>0$ define the function $h_c$ as $h_c(x)=\displaystyle{\sup_{n\in\mathbb{N}}n^cf(nx)}$. Prove the following:
A) For $0<c<1$, $h_c\in L^1(\mathbb{R})$.
B) $h_1\in L^1_w(\mathbb{R})$ but $h_1\not\in L^1(\mathbb{R})$.
C) For $c>1$, $h_c\not\in L^1_w(\mathbb{R})$.
My solution goes as follows:
A) Observe that the function $x\mapsto n^cf(nx)$ admits non-zero values on the interval $(0, \displaystyle{\frac{1}{n})}$. Also observe that $h_c$ is the pointwise limit of the increasing function-sequence $(G_n)_{n\in\mathbb{N}}$ with $G_n(x)=\displaystyle{\sup_{k=1,\dots, n}k^cf(kx)}$ and, since these suprema are taken over a finite set, $G_n(x)=k_n^cf(k_nx)$ for some integer $k_n\in\{1,\dots, n\}$. Now, one has $$\int_\mathbb{R}h_c(x)dx=\lim_{n\to\infty}\int_\mathbb{R}G_n(x)dx=\lim_{n\to\infty}\int_\mathbb{R}k_n^cf(k_nx)dx=$$ $$=\lim_{n\to\infty}\int_{0}^{\frac{1}{k_n}}k_n^cf(k_nx)dx\leq\limsup_{n\to\infty}k_n^c\|f\|_\infty<+\infty$$ since f is continuous and compactly supported and $\displaystyle{\limsup_{n\to\infty}k_n^c}$ is either $0$, if $(k_n)$ is unbounded, or a finite positive number, if $(k_n)$ is bounded (recall that $(k_n)$ is a sequence of natural numbers).
B) For starters lets have a closer look on the functions $x\mapsto n^cf(nx)$. For $n=1$, this function is $f(x)$ with $(0,1)$ as its support. For $n=2$, the function is $2^cf(2x)$ with $(0,\frac{1}{2})$ as its support. For $n=3$, the function is $3^cf(3x)$ with $(0,\frac{1}{3})$ as its support. With that in mind, we observe that $h_c(x)$ is:
Equal to $f(x)$ on the interval $[\frac{1}{2}, 1)$
Equal to $\sup\{f(x), 2^cf(2x)\}$ on the interval $[\frac{1}{3}, \frac{1}{2})$,
Equal to $\sup\{f(x), 2^cf(2x), 3^cf(3x)\}$ on the interval $[\frac{1}{4}, \frac{1}{3})$ and so on.
By applying Beppo Levi's theorem, we now have $$\|h_1\|_1=\int_{0}^{1}|h_1(x)|dx=\sum_{n=1}^{\infty}\int_{\frac{1}{n+1}}^{\frac{1}{n}}h_1(x)dx\geq\sum_{n=1}^{\infty}\int_{\frac{1}{n+1}}^{\frac{1}{n}}a_nf(a_nx)dx$$ for any choice of $a_n\in\{1,\dots n\}$. Now by the change of variable $u=a_nx$, the latter sum is equal to $\displaystyle{\sum_{n=1}^{\infty}\int_{\frac{a_n}{n+1}}^{\frac{a_n}{n}}f(u)du}$. We now specify a choice: we choose $a_n$ to be the smallest integers greater or equal to $\frac{n}{2}$. By ignoring the odd-indexed terms of the sum, we get the inequality $$\|h\|_1\geq\sum_{n\in2\mathbb{N}}\int_{\frac{1}{2}-\frac{1}{2n}}^{\frac{1}{2}}f(u)du$$ and if $m:=\displaystyle{\min_{[\frac{1}{4}, \frac{1}{2}]}(f)}$, then $m>0$ and then the latter sum in the inequality above is greater or equal to $\displaystyle{\sum_{n\in2\mathbb{N}}\frac{m}{2n}=+\infty}$. Hence $h_1\not\in L^1(\mathbb{R})$.
For the weak norm, let $a>0$. If $a< M:=\max(f)$, then $a\cdot m(\{x: h_1(x)>a\})\leq M$, $m$ being the Lebesgue measure. If $a\geq M$, then there exists a unique positive integer $k$ such that $a\in [kM, (k+1)M)$. Now if $x\in \{x: h_1(x)>a\}$, then there exists $n_0\in\mathbb{N}$ such that $n_0f(n_0x)>a$, hence $n_0f(n_0x)>kM$, but since $f(n_0x)<M$, we have $n_0>k$. But $x\mapsto n_0f(n_0x)$ has $(0, \frac{1}{n_0})$ as support and $(0,\frac{1}{n_0})\subset (0,\frac{1}{k})$, so $x\in(0,\frac{1}{k})$. So $a\cdot m(\{h_1>a\})\leq\frac{k+1}{k}M\leq 2M<+\infty$. Hence $h_1\in L^1_w(\mathbb{R})$.
C) We focus on the interval $[M, +\infty)$. By breaking it down to the union of $[k^cM, (k+1)^cM)$ for $k\in\mathbb{N}$, if $a>M$, we pick the unique integer such that $a\in [k^cM, (k+1)^cM)$. We have $\{x: (2k)^cf(2kx)>a\}\subset\{h_c>a\}$, so $$m(\{h_c>a\})\geq m(\{x: (2k)^cf(2kx)>a\})\geq m(\{x: f(2kx)>\frac{M}{2^c}\})=$$ $$=\frac{1}{2k}m(\{y: f(y)>\frac{M}{2^c}\})$$ The measure that has come up though is a constant and strictly positive quantity (say $C_0$), since $f$ attains its maximum at at least one point and, from its continuity, there exist neighbourhoods about these points at which $f$ admits values greater than $\frac{M}{2^c}$. So $$a\cdot m(\{h_c>a\})\geq\frac{k^cM}{2k}C_0$$ for $a\in [k^cM, (k+1)^cM)$. We conclude that while $a\to\infty$, $a\cdot m(\{h_c>a\}\to\infty$.
A little extensive, but I think it's a nice one. Also, I believe that there are many tricks one could use to solve this problem, so I'm looking forward to other approaches!