The Multiplication Operator $M_f: L^2(\mu) \to L^2(\mu)$ such that $M_f g = fg$ (Rudin) This post is related but does not answer my question.
Question 2 is partly unaddressed. Perhaps we can split into two cases, (i) where $\mu(\{f = 0\}) = 0$ and (ii) $\mu(\{f = 0\}) > 0$? If $\mu(\{f = 0\}) = 0$, then $g = h/f$ a.e.

Problem $5.17$ (paraphrased), Rudin's Real and Complex Analysis.

If $\mu$ is a positive measure, each $f\in L^\infty(\mu)$ defines a multiplication operator $M_f$ on $L^2(\mu)$ into $L^2(\mu)$, such that $M_f(g) = fg$. Prove that $\|M_f\| \le \|f\|_\infty$.

I have shown that $\|M_f\| \le \|f\|_\infty$.
Question 1:

For which measures $\mu$ is it true that $\|M_f\| = \|f\|_\infty$ for all $f\in L^\infty(\mu)$?

Question 2:

For which $f\in L^\infty(\mu)$ does $M_f$ map $L^2(\mu)$ onto $L^2(\mu)$?


My work:

*

*We need to find measures $\mu$ for which the reverse inequality, i.e. $\|M_f\| \ge \|f\|_\infty$ also holds, for all $f\in L^\infty(\mu)$. More explicitly, we need
$$\sup\{\|M_f g\|_2: g\in L^2(\mu), \|g\|_2 \le 1\} = \|f\|_\infty \quad (f\in L^\infty(\mu))$$
where $$\|f\|_\infty = \inf\{a\in\mathbb R: \mu(\{|f| > a\}) = 0\}$$

*Consider $h\in L^2(\mu)$. We want $g\in L^2(\mu)$ such that $M_f g = fg = h$. If $1/f \in L^\infty(\mu)$, the map is surjective. Is the converse true? If not, could one help me get an iff condition without assuming anything on $\mu$ besides that it is a positive measure?

I'd appreciate any help, thank you!

Update:
The proof below by Jose Avilez, and Jean L., Theorem $1.5$ tells us that $\|M_f\| = \|f\|_\infty$ for all $f\in L^\infty(\mu)$ iff $\mu$ is semi-finite.
 A: A modification to the counter example in @OliverDiaz answer can be used to show that semi-finiteness of the measure $\mu$ is also a necessary condition for $\|M_f\|=\|f\|_\infty$.
Suppose $\mu$ is not semi-finite. This means that  there exists a set $A$ with $\mu(A)=\infty$ such that for any measurable set $B$, if $B\subset A$ and $\mu(B)>0$, then $\mu(B)=\infty$. Define $f=\mathbb{1}_A$, where $\mathbb{1}_A$ is the indicator function of the set $A$. It is easy to check that $\|f\|_\infty=1$. For any $g\in L_2$
$$\Big|\int_A g(x) \mu(dx)\Big|^2=|M_fg|^2\leq\|g\|^2_2<\infty$$
We claim that $\mu(\{x\in A:|g(x)|>0\})=0$. Otherwise, since $\{x\in A: |g(x)|>0\}=\bigcup^\infty_{n=1}\big\{x\in A: |g(x)|>\frac1n\big\}$, there is $n\in\mathbb{N}$ such that $\mu(\{x\in A: |g(x)|>\tfrac1n\})>0$. This implies that
$$\infty=\mu(\{x\in A: |g(x)|>\tfrac1n\})\leq n\int_A |g(x)|\,\mu(dx)=n M_f(|g|)\leq n\|g\|_2<\infty$$
which is not possible.
If follows that $M_fg=0$ for all $g\in L_2$; therefore $0=\|M_f\|<1=\|f\|_\infty$.
A: For (1) it suffices for $\mu$ to be $\sigma$-finite. Let $\epsilon > 0$. By $\sigma$-finiteness of $\mu$ and by the definition of essential supremum, you may get a set $E$ with $0 < \mu (E) < \infty$ such that $$|f(x)| \geq ||f||_\infty - \epsilon$$ for $x \in E$ (*). Set $g = \frac{\chi_E}{\sqrt{\mu(E)}}$, so that $g \in L^2 (\mu )$ and $||g||_2 = 1$. It follows that $$||M_f||^2 \geq ||fg||_2^2 = \frac{1}{\mu (E)} \int_E|f|^2 d \mu \geq (||f||_\infty- \epsilon)^2$$ Sending $\epsilon \to 0^+$, we get the opposite inequality.
Note that if your measure is not $\sigma$-finite, then this may fail. In particular, you may wish to consider a measure space containing an atom of infinite measure to find a counterexample.
(*) More generally, this holds for semi-finite measures. See comment by MaoWao below, and the answer by Oliver Diaz.
For (2), you want $f \in L^\infty$ such that $\inf |f| = c > 0$. In this case, if $g \in L^2$, you wish to find a $k \in L^2$ such that $M_f(k) = fk = g$. Since $f \neq 0$ (at least a.e.), we may write $k = \frac{g}{f}$. We then verify that $k \in L^2$, by noting that $$||k||_2^2 = \int \frac{g^2}{f^2} \leq \frac{1}{\inf |f|^2} \int g^2 < \infty$$
A: This discusses a counterexample to show that if $\mu$ is not $\sigma$--finite (or more generally, semi finite), then $\|M_f\|=\|f\|_\infty$ may fail.
(Conway, J., A Course in functional analysis, 2nd edition, Springer , p. 28) Consider the space $([0,1],\mathscr{B}([0,1])$ its the measure $\mu=\lambda +\infty\delta_0$, here $\lambda$ is Lebesgue's measure, and $\delta_0$ is the measure that gives mass $1$ to $\{0\}$. Then $\mu(A)=\lambda(A)$ if $A$ is Borel measurable and does not contain $0$, and $\infty$ other wise. Define $f=\mathbb{1}_{\{0\}}$. Clearly $\mu$ is not semi-finite $\mu(\{0\})=\infty$), and $\|f\|_\infty=1$. For any $g\in L_2$
$$|g(0)|^2\mu^2(\{0\})=|M_fg|^2\leq \|g\|^2_2= \int |g|^2d\mu<\infty$$
This means that $g(0)=0$ for all $g\in L_2$. Therefore $M_f=0$, and $\|M_f\|<\|f\|_\infty$.

The following addresses question 2. First we show the following result.

Lemma: Suppose $\mu$ is semi finite. If $f$ is a measurable function such that the operator $M_f:L_2\rightarrow L_2$ given by $g\mapsto gf$ is a bounded,  then $f\in L_\infty$.

Proof: Suppose $f\notin L_\infty(\mu)$, and set $E_n=\{n\leq |f|<n+1\}$. Then, there are infinitely many $E_n$'s (say $E_{n_k}$) that have positive measure. Let $A_{n_k}\subset E_{n_k}$ with positive finite measure. Define $$g=\sum_k\frac{1}{n_k\sqrt{\mu(A_{n_k})}}\mathbb{1}_{A_{n_k}}$$
Then $g\in L_2(\mu)$ for $\int|g|^2\,d\mu=\sum_k\frac{1}{k^2}$. On the other hand,
$$\int|f g|^2\,d\mu=\sum_k\frac{1}{n^2_k\mu(A_{n_k})}\int_{A_{n_k}}|f|^2\,d\mu\geq \sum_k1=\infty$$
in contradiction to $g\,f\in L_2(\mu)$. Therefore, $f\in L_\infty(\mu)$.
We now prove the following:

Under the assumptions of the Lemma above, $M_f:L_2\rightarrow L_2$ is onto iff there is $c>0$ such that $c<|f|\leq\|f\|_\infty$ $\mu$-a.s.

If $0<c<|f|\leq\|f\|_\infty$ then $1/f\in L_\infty$. Clearly $M_f$ is bijective, with $M^{-1}_f=M_{1/f}$.
Conversely, suppose $f\in L_\infty$ is such that $M_f$ is onto.
Claim: $\mu(f=0)=0$. Otherwise, there would be a set $E$ of positive finite measure on which $|f|=0$. Then, the function $g=\mathbb{1}_E\in L_2$, $\|g\|_2>0$, but for no $h\in L_2$ is $M_fh=g$. This proves the claim.
Now, since $0<|f|$ $\mu$-a.s., it follows that $M_f$ is one-to-one, for $M_fh=M_gh'$ iff $fh=fh'$ $\mu$-a.s and so, iff  $h=h'$ $\mu$-a.s. An application of the open map theorem (Theorem 5.10 in Rudin's aforementioned book) implies that $M_f$ has an inverse $M^{-1}_f:L_2\rightarrow L_2$, which is also a bounded operator. Notice that the inverse $M^{-1}_f$ is given by $h\mapsto h/f$, that is $M^{-1}_f$ is the product operator $M_{1/f}$. As $M_{1/f}$ is a bounded operator from $L_2$ into itself, the Lemma we proved above implies that $1/f\in L_\infty$. This shows that with $c=1/\|1/f\|_\infty>0$,
$$ c\leq |f|\leq \|f\|_\infty,\qquad\mu-\text{almost everywhere}$$

Comment: In the solution of @JoseAvilez, only semifiniteness of $\mu$ is used. That is, if $\|f\|_\infty\neq0$ and $0<\varepsilon<\|f\|_\infty$, then  $\mu(|f|>\|f\|_\infty-\varepsilon)>0$ and so, there is a measurable set $E\subset \{|f|>\|f\|-\varepsilon\}$ with $0<\mu(E)<\infty$. The rest of the argument as in that solution.
A: This is to address a question by the OP regarding the case where $\mu$ is not semi finite and $M_f:L_2\rightarrow L_2$ is onto.
Define
$$\mu_0(E)=\sup\{\mu(F): F\subset E, \, \mu(F)<\infty\}$$
This defines a measure on $(X,\mathscr{F})$:

*

*Clearly $\mu_0(\emptyset)=0$, $\mu_0(E)\geq0$ for all $E\in\mathscr{F}$,  $\mu_0(E_1)\leq \mu_0(E_2)$ whenever $E_1\subset E_2$.

*$\mu_0$ is $\sigma$-aditive: Suppose $\{E_n:n\in\mathbb{N}\}$ are pairwise disjoint, and w.l.o.g. $\mu(E_n)>0$. If $A\subset\bigcup_nE_n$ and $\mu(A)<\infty$ then
$$\mu(A)=\sum^\infty_{n=1}\mu(A\cap E_n)\leq\sum^\infty_{n=1}\mu_0(E_n)$$
Hence $\mu_0(\bigcup_nE_n)\leq\sum^\infty_{n=1}\mu_0(E_n)$. If $\mu_0(E_{n'})=\infty$ for some $n'$, then $\infty=\mu_0(E_{n'})\leq \mu_0(\bigcup_nE_n)=\sum^\infty_{n=1}\mu_0(E_n)$. Suppose $\mu_0(E_n)<\infty$ for all $n$. Choose $A_n\subset E_n$ such that $\mu_0(E_n)<\mu(A_n)+2^{-n}\varepsilon<\infty$. Then
$$\sum^N_{n=1}\mu_0(E_n)\leq\sum^N_{n=1}\mu(A_n)+\varepsilon(1-2^{-N})=\mu(\bigcup^N_{n=1}A_n)+\varepsilon(1-2^{-N})\leq\mu_0(\bigcup_nE_n)+\varepsilon$$
It follows that $\mu_0(\bigcup_nE_n)=\sum_n\mu_0(E_n)$.

Notice that if $E$ is an atom of $\mu$ with infinite mass ($\mu(E)=\infty$), then $\mu_0(E)=0$. Also, it is clear that if $\mu(F)<\infty$, then $\mu_0(F)=\mu(F)$.
Claim:  If $\mu(F)=\infty$ and $F$ does not contain an atom of infinite mass, then $\mu_0(F)=\infty$. To see this,  let $E_n\subset F$ such that $\mu(E_n)<\infty$ and $\mu(E_n)\xrightarrow{n\rightarrow\infty}\mu_0(F)$. Substituting $E_n$ with $\bigcup^n_{k=1}E_k$ if necessary, we may assume that $E_n$ is monotone nondecreasing. Setting $E=\bigcup_nE_n$, we have that $\mu_0(F)=\lim_n\mu(E_n)=\mu(E)$.
If $\mu(F\setminus E)>0$, there is $A\subset F\setminus E$ such that $0<\mu(A)<\infty$. It follows that $\mu_0(E)<\mu(E)+\mu(A)=\mu(E\cup A)<\infty$ in contradiction to the definition of $\mu_0(E)$. Hence $\mu_0(F\setminus E)=0$ and so, $\mu(E)=\mu(F)=\infty$.
A consequence of the claim above is that $\mu_0$ is a semi-finite measure.
Let $\nu:\mathscr{F}\rightarrow\overline{\mathbb{R}}$ defined as
$\nu(A)=\infty$ if $A\in\mathscr{F}$ contains an atom of infinite $\mu$ mass, and $0$ otherwise. It is easy to check that  $\nu$ is a measure, and that
$$\mu=\mu_0+\nu$$


*

*Notice that $L_2(\mu)=L_2(\mu_0)$.

*If $A$ is an atom of inifinite $\mu$-mass, then as the answer of JeanL shows, $g\mathbb{1}_A=0$ for all $g\in L_2(\mu)$; hence, $\int fg\,d\nu=\int_A fg\,d\nu +\int_{A^c}fg\,d\mu=0$.

All this  shows that it is enough to concentrate on the measure $\mu_0$. An we can proceed as in the solution presented for the case where $\mu$ is semi-finite.
