the angular momentum operator L has follow properties:

$L^2 \left| l, m \right> = l(l+1) \hbar \left|l,m\right>$

$L_z \left |l,m \right> = m \hbar \left|l, m \right>$

for a spin 1 operator, we know that it is 3 dimensional. thus:

$S^2\left|m\right>=2\left|m\right>$

$S_z\left |m\right>=m\left|m\right>$

Thus, we have:

$L^2(l=1) = \frac{\hbar}{2} S^2$

where the size of L is narrowed to l =1 .

with a position bra act from the left, the L becomes:

$L^2 Y_l^m = l(l+1) \hbar Y_l^m$

$L_z Y_l^m = m \hbar Y_l^m$

$Y_l^m = \sqrt{\frac{3}{4 \pi}} \left< \hat{r} | l,m \right>$

on the counter part of spin 1 operator, the ket can be replaced by a real vector. and for any vector v, we can expand it by the 3 eigenvectors:

$\vec{v} = \left| v \right> = \sum \left|m \right> \left< m| v \right> = \sum v_m \left|m\right>$

thus, we suitable constant, a unit vector can be written in:

$\hat{r} =\sqrt{\frac{4\pi}{3}}\sum\left|m\right>Y_1^{m *}$

this is how the spherical harmonic enter the vector and then, later in matrix, and become operator.