Differences among \mathrm, \text, and \operatorname in LaTeX
\mathrm, \text
code1
$$
\begin{array}{cc}
\mathrm{sin}(\mathrm{mathrm}) & \text{sin}(\text{text})
\end{array} \\[1em]
\text{basic font: abcdefghijklmnopqrstuvwxyz}
$$
When you look at the default setting, there seems to be no difference in rendering between \mathrm and \text. That is because the default font itself is exactly the same as \mathrm. \mathrm is precisely rendered in Roman type, while \text follows the font that has been set. Therefore, changing the font would result in the following rendering.
$$ \begin{array}{cc} \mathrm{sin}(\mathrm{mathrm}) & \textsf{sin}(\textsf{text}) \end{array} \\[1em] \textsf{basic font: abcdefghijklmnopqrstuvwxyz} $$
\operatorname
Both \mathrm and \text render 'characters', whereas \operatorname, as the name suggests, renders it in a way that it can appear as an operator. For instance, the sine function rendered in four ways looks as follows.
code2
$$ \begin{array}{cccc} a\mathrm{sin}x & a\text{sin}x & a\operatorname{sin}x & a\sin x \\ (\text{mathrm}) & (\text{text}) & (\text{operatorname}) & (\text{sin}) \end{array} $$
In the case of \mathrm and \text, it’s not clear whether it’s asinx or a sin x, but with \operatorname, it’s easy to see that the sin part signifies an operator.
\operatorname*
Adding $\ast$ behind, there’s no difference in inline mode, but in display mode, the subscript moves above and below.
code3
$$ {\textstyle \operatorname{Proj}_{a}^{b} \quad \operatorname*{Proj}_{a}^{b}}\quad (\text{ inline mode}) $$
$$ \operatorname{Proj}_{a}^{b} \quad \operatorname*{Proj}_{a}^{b}\quad (\text{ display mode}) $$