How is an operator applied to a wavefunction in quantum mechanics? If you have the Hamiltonian operator written as such:
$$\hat H =  -\frac{\hbar}{2m}\frac{1}{r}\frac{\partial^2}{\partial r^2}r  \tag{1}$$
then to apply the Hamiltonian operator to a wavefunction, do you apply the separate operations in order from right to left, as in:
$$\hat H \Psi =  -\frac{\hbar}{2m}(\frac{1}{r}(\frac{\partial^2}{\partial r^2}(r \Psi))) \tag{2}$$
and so on?
At first I thought you applied each operation to the wavefunction separately and then multiplied all the sections together but this seems rather clunky.
Forgive me for asking such a clueless question but I cannot find the answer anywhere!
 A: It is the same as matrix mathematics. In general quantum mechanics is linear algebra in funny hats.
That is, suppose I want to compute $\frac 12 \langle \hat X \hat P + \hat P \hat X\rangle,$ the closest Hermitian observable to the moment $\langle x p \rangle$ in classical mechanics. The relation that $[\hat X, \hat P] = i\hbar$ is usually taken to mean that in the position basis, $\hat X = (x\cdot)$ while $\hat P = -i\hbar \frac{\partial}{\partial x},$ so the first part of this integral is:$$\langle \hat X \hat P\rangle = -i\hbar \int_{-\infty}^\infty dx~\Psi^*(x)\cdot x\cdot\frac{\partial\Psi}{\partial x},$$ while the second part is $$\langle \hat P \hat X\rangle = -i\hbar\int_{-\infty}^\infty dx~\Psi^*(x)\cdot \frac{\partial}{\partial x}\big(x \cdot \Psi(x)\big).$$ 
The juxtaposition $\hat X~\hat P$ is really a sort of operator composition, just like how the matrix multiplication between two matrices forms a composition of the transforms that they describe.
A: *

*Yes, OP is right: We understand composition of operators $\hat{A}$ and $\hat{B}$ as $$(\hat{A}\circ \hat{B})(v)~:=~ \hat{A}(\hat{B}(v)), \tag{A}$$ 
where $v$ is a vector. Note that the composition symbol "$\circ$" and parenthesis "$()$" are often not written explicitly. This agrees with OP's eqs. (1) & (2). So far so good.

*Things get surprisingly intricate, when we implement this rule (A) on the Dirac notation. Then we define 
$$\psi(x)~:=~\langle x | \psi \rangle
~=~| x \rangle^{\dagger}| \psi \rangle, \tag{B}$$ 
$$ (\hat{A} (\psi))(x)~:=~ \langle x |\hat{A}| \psi \rangle
~=~\left(\hat{A}^{\dagger}| x \rangle\right)^{\dagger}| \psi \rangle, \tag{C} $$ 
$$ ((\hat{A}\circ \hat{B})(\psi))(x)
~:=~ \langle x |(\hat{A}\circ \hat{B})| \psi \rangle
~=~\left((\hat{B}^{\dagger}\circ \hat{A}^{\dagger})| x \rangle\right)^{\dagger}| \psi \rangle, \tag{D}$$ and so forth. Here $|x\rangle$ denotes the position ket state with eigenvalue $x$,
$$  \hat{x}|x\rangle ~=~x  |x\rangle. \tag{E}$$

*Let us for simplicity assume that the operators $\hat{A}$, $\hat{B}$, etc, are self-adjoint. If one has never seen the lhs. of eq. (D) before, one might worry that the operators $\hat{A}$ and $\hat{B}$ seem to be composed in the wrong order! It turns out that in the end, it works out correctly after all. See e.g. the next example. 

*Example: The convention (A) implies that
$$ \hat{p}\circ \hat{x}|x\rangle ~\stackrel{(A)+(E)}{=}~x \hat{p}|x\rangle \tag{F},$$
because $\hat{p}$ is a linear operator. Therefore, we calculate
$$ ((\hat{x}\circ \hat{p})(\psi))(x)
~\stackrel{(D)}{=}~\left((\hat{p}\circ \hat{x})| x \rangle\right)^{\dagger}| \psi \rangle
~\stackrel{(F)}{=}~x\left(\hat{p}| x \rangle\right)^{\dagger}| \psi \rangle
~\stackrel{(C)}{=}~x(\hat{p}( \psi))(x),$$
as it should be. See also my related Phys.SE answer here.
