The commutator of position and momentum operators in three-dimensional Cartesian coordinates I'm to calculate the commutator of the following operators : $\mathbf{\widehat{r}}=\mathbf{e}_{x}x+\mathbf{e}_{y}y+\mathbf{e}_{z}z$ and $\mathbf{\widehat{p}}=-i\hbar\left ( \mathbf{e}_{x}\frac{\partial }{\partial x}+\mathbf{e}_{y}\frac{\partial }{\partial y}+\mathbf{e}_{z}\frac{\partial }{\partial z} \right )$. This is what I have attempted : $$\left [ \mathbf{\widehat{r}},\mathbf{\widehat{p}} \right ]\varphi=-i\hbar\left ( \mathbf{e}_{x}x +\mathbf{e}_{y}y+\mathbf{e}_{z}z\right )\left ( \mathbf{e}_{x}\frac{\partial \varphi  }{\partial x}+\mathbf{e}_{y}\frac{\partial \varphi }{\partial y}+\mathbf{e}_{z}\frac{\partial\varphi  }{\partial z} \right )+i\hbar \left ( \mathbf{e}_{x}\frac{\partial }{\partial x}+\mathbf{e}_{y}\frac{\partial }{\partial y}+\mathbf{e}_{z}\frac{\partial }{\partial z} \right )\left ( \mathbf{e}_{x}x \varphi +\mathbf{e}_{y}y\varphi +\mathbf{e}_{z}z\varphi \right )=-i\hbar\left ( x\frac{\partial \varphi }{\partial x}+y\frac{\partial\varphi  }{\partial y}+z\frac{\partial \varphi }{\partial z} \right )+i\hbar\left (x\frac{\partial \varphi }{\partial x}+y\frac{\partial\varphi  }{\partial y}+z\frac{\partial \varphi }{\partial z}+3\varphi   \right )=3i\hbar \varphi \Rightarrow \left [\mathbf{\widehat{r}},\mathbf{\widehat{p}} \right ]=3i\hbar$$ What confuses me is that $\mathbf{\widehat{r}}\varphi$ is a vector valued function, so I cannot calculate the gradient $\nabla\left ( \mathbf{\widehat{r}\varphi} \right )$, so instead I took the divergence $\nabla\cdot \left ( \mathbf{\widehat{r}\varphi} \right )$ to obtain the result above. Is commutator a scalar? Judging by all the examples I've seen it is, but nowhere has this point been made explicit. 
 A: Obvious it is much easier to just write down the CCR in components$^1$
$$ [\hat{x}^j,\hat{p}_k]~=~i\hbar \delta^j_k \hat{\bf 1} ,\tag{1}$$
but OP seems to ponder the following interesting question.

Question: How do we take the commutator of two vector-valued operators?

Answer: Well, here is one possible construction. Let us generalize a bit and consider two symmetric tensor-valued operators
$$ \hat{\bf T}~=~ \sum_{j_1,\ldots, j_r}{\bf e}_{j_1} \odot \ldots \odot{\bf e}_{j_r} \hat{T}^{j_1\ldots j_r} \tag{2}$$
and 
$$ \hat{\bf S}~=~ \sum_{k_1,\ldots, k_s}{\bf e}_{k_1} \odot \ldots \odot{\bf e}_{k_s} \hat{S}^{k_1\ldots k_s}. \tag{3}$$
Define composition as
$$\hat{\bf T}\circ \hat{\bf S} ~:=~ \sum_{j_1,\ldots, j_r,k_1,\ldots, k_s} {\bf e}_{j_1} \odot \ldots \odot{\bf e}_{j_r}\odot {\bf e}_{k_1} \odot \ldots \odot{\bf e}_{k_s} \hat{T}^{j_1\ldots j_r}\circ \hat{S}^{k_1\ldots k_s}.\tag{4}$$
Define the commutator as
$$\begin{align}[\hat{\bf T}, \hat{\bf S}] ~:=~&\hat{\bf T}\circ \hat{\bf S}- \hat{\bf S}\circ \hat{\bf T}\cr
~=~&\sum_{j_1,\ldots, j_r,k_1,\ldots, k_s} {\bf e}_{j_1} \odot \ldots \odot{\bf e}_{j_r}\odot {\bf e}_{k_1} \odot \ldots \odot{\bf e}_{k_s} [\hat{T}^{j_1\ldots j_r} , \hat{S}^{k_1\ldots k_s}]. \end{align}\tag{5}$$
Now we can make sense to OP's question. The commutator (6) of two vector-valued operators is a 2nd-rank tensor-valued operator:
$$[\hat{\bf x}, \hat{\bf p}]~=~[\sum_j{\bf e}_j\hat{x}^j, \sum_k{\bf e}^k\hat{p}_k]~\stackrel{(1)+(5)}{=}~ \sum_j{\bf e}_j\odot {\bf e}^j~i\hbar  \hat{\bf 1}.\tag{6}$$
Notice that the corresponding tensor components are just the CCR (1), so eqs. (1) & (6) are equivalent formulations. A textbook will usually only work in components to avoid having to introduce the notion of tensor operators (2). 
--
$^1$ For the purpose of this answer, let us raise and lower 3D indices with a metric $g_{jk}$. 
