# Is a distance function on $\mathbb{R}^n$ convex?

Fix $z \in \mathbb{R}^n$.

Let $||\cdot||$ be a norm on $\mathbb{R}^n$, and define the distance function $f(x)=||z-x||$ for $x\in \mathbb{R}^n$

Then, is it true that $f(x)$ is convex?

Yes, it is. Take $x,y\in\mathbb{R}^n$, and $\lambda\in [0;1]$. Then
$$f(\lambda x + (1-\lambda)y) = ||z-\lambda x - (1-\lambda)y|| = ||\lambda z + (1-\lambda)z - \lambda x - (1-\lambda)y || = ||\lambda(z-x)+(1-\lambda)(z-y)|| \leq ||\lambda(z-x)|| + ||(1-\lambda)(z-y)|| = \lambda||z-x|| + (1-\lambda)||z-y|| = \lambda f(x) + (1-\lambda)f(y)$$