What does the term in the right mean? Reading an article about clustering, I came across this equality:

It's basically a sum over $ \mu_{i,j}(1-cos(x_i, p_j))$ (where $ \cos(x_i, p_j) $ is the cosinus between two vectors in $\mathbb{R}^n$). And then suddenly some magic happens and the formula in the right appears. Can somebody explain? 
Note: I understand that the parenthesis was expanded (each term got multiplied by $ \mu_{i,j}$). But what is that huge dot product and why does it have this form?
 A: Remember that the inner product is bilinear: for three vectors $u,v,w$ and scalars $\alpha,\beta$,
$$
\langle \alpha u, \beta v\rangle = \alpha\beta\langle u, v\rangle, \qquad \langle u, v+w\rangle = \langle u, v\rangle+\langle u, w\rangle
$$
What happened above is exactly what follows when applying these rules: for every $i,j$
$$
\frac{\langle x_i, p_j\rangle}{\lVert x_i\rVert\lVert p_j\rVert} = \left\langle \frac{x_i}{\lVert x_i\rVert}, \frac{p_j}{\lVert p_j\rVert}\right\rangle \tag{1}
$$
since $\lVert x_i\rVert,\lVert p_j\rVert\in\mathbb{R}$ are scalars (the brackets became "bigger" just for style considerations, like parentheses would be drawn bigger when what's inside looks "large").
Then, each $\mu_{ij}$ is also a scalar, and you have a sum, so
$$
\sum_{i} \mu_{ij}\left\langle \frac{x_i}{\lVert x_i\rVert}, \frac{p_j}{\lVert p_j\rVert}\right\rangle
= \sum_{i} \left\langle \mu_{ij}\frac{x_i}{\lVert x_i\rVert}, \frac{p_j}{\lVert p_j\rVert}\right\rangle
= \left\langle \sum_{i}\mu_{ij}\frac{x_i}{\lVert x_i\rVert}, \frac{p_j}{\lVert p_j\rVert}\right\rangle \tag{2}
$$
Note that it does make sense: $\sum_{i}\mu_{ij}\frac{x_i}{\lVert x_i\rVert}$ is a vector, and so is $\frac{p_j}{\lVert p_j\rVert}$. So it's indeed the inner product between two vectors.
