# Operations that preserve convexity

I am trying to detemine if the expression below is concave or convex using operations that preserve convexity http://web.stanford.edu/class/ee364a/lectures/functions.pdf.

$Var[x] = E(x^2) - E(x)^2$

• $E(x)$ is concave / convex because it is a sum of linear terms
• $E(x)^2$ is convex because of power 2
• $E(x^2)$ is concave / convex because it still is a sum of linear terms.

Would this be correct ? So then what would $E(x^2) - E(x)^2$ be since it is convex - affine ?

• is $x$ a continuous or discrete random variable? Apr 18, 2018 at 12:06
• $E(x^2)$ is convex, because it is a sum of convex terms. So you get convex-convex, which is inconclusive. Apr 18, 2018 at 12:10
• What does it mean for a function of a random variable to be convex? Apr 18, 2018 at 12:12
• @LinAlg Ah right, I missed out that $x^2$ is convex. Lets say that the expression is convex minus affine. What would the result be ? Since an affine function is both convex and concave. A convex + affine function would still be convex I believe.
– Kong
Apr 18, 2018 at 12:16
• @kong subtracting an affine function from a convex function is the same as adding an affine function to a convex function, since the additive inverse of an affine function is again affine. Apr 18, 2018 at 12:19

It is hard to say based on the expression you have. It is much easier by using this expression: $$\text{Var}[x] = \min_{\mu \in \mathbb{R}}\mathbb{E}(x-\mu)^2.$$ It is clear that $f(x,\mu) = \mathbb{E}(x-\mu)^2$ is jointly convex, and partial minimization preserves convexity.