Let $x \in \mathbb{R}^n$. Let there be a collection of functions $d_i = (x_j - x_k)^2$ (note that the subscripts $j$ and $k$ are fixed for each $d_i$, and there can be repeated use of subscripts on different $d_i$'s. Define the function:
$$f(x) = \sqrt{ \sum_i d_i }$$
Is this function convex? I know in the case where subscripts are not repeated, it is:
Is a distance function on $\mathbb{R}^n$ convex?
I think this proof still holds, but I'd like it if someone could help me validate it.
The context is that I wish to formulate a convex optimization problem. I know I can always do this by adding auxiliary variables such that all the subscripts are unique, and then adding equality constraints of the form $x_a = x_b$ for any two auxiliary variables which are supposed to represent the same variable in the original problem. But, I'd like to know if the unconstrained formulation is convex.
Let the vector of differences be given by $C x$, where $C \in \mathbb{R}^{m \times n}$ is the oriented incidence matrix of a graph with $n$ nodes and $m$ edges. Hence,
$$f (x) := \sqrt{x^T C^T C x} = \sqrt{\|Cx\|_2^2} = \| C x\|_2$$
where $C^T C$ is the Laplacian matrix of the same graph. Thus, $f$ is convex. It is strictly convex if $C$ has full column rank.