Suppose the coordinates of $n$ particles of masses $m_{1}, m_{2}, \ldots, m_{n}$ are $(x_{1}, y_{1}, z_{1}), (x_{2}, y_{2}, z_{2}), \ldots, (x_{n}, y_{n}, z_{n})$ respectively.
The position of the centre of mass $(X, Y, Z)$ is given by:
$(X, Y, Z) = \frac{m_{1}(x_{1}, y_{1}, z_{1}) + m_{2}(x_{2}, y_{2}, z_{2}) + \ldots + m_{n}(x_{n}, y_{n}, z_{n})}{m_{1} + m_{2} + \ldots + m_{n}}$
$= \frac{\sum_{i=1}^{n} m_{i}(x_{i}, y_{i}, z_{i})}{\sum_{i=1}^{n} m_{i}}$
This can be expressed in terms of individual coordinates as:
$X = \frac{\sum m_{i} x_{i}}{M}, Y = \frac{\sum m_{i} y_{i}}{M}, Z = \frac{\sum m_{i} z_{i}}{M}$
where $M = \sum m_{i}$ is the total mass of the system.
Using position vectors,if $\vec{r}_{i} = x_{i}\hat{i} + y_{i}\hat{j} + z_{i}\hat{k}$ is the position vector of the $i$-th particle,the position vector of the centre of mass $\vec{R}$ is:
$\vec{R} = \frac{\sum m_{i} \vec{r}_{i}}{M}$
If the origin of the coordinate system is at the centre of mass,then $\sum m_{i} \vec{r}_{i} = 0$.