# Examples of affine functions and convex sets

I'm just learning about convexity and affineness, and I've read over some similar questions asked here, but those were more about general properties. I need some help applying those properties to a few examples that I can't seem to understand. I'd like to see how to show:

1. $C_{1} = \lbrace x \in \mathbb{R}^{n} \mid h(x) = 0 \rbrace$ is convex iff $h(x)$ is affine in $C_{1}$

2. $C_{2} = \lbrace x \in \mathbb{R}^{n} \mid g(x) \leq 0 \rbrace$ is convex if $g(x)$ is convex on $C_{2}$

3. $C_{3} = \lbrace x \in \mathbb{R}^{n} \mid h_{i}(x) = 0,i=1,\ldots,m;\,g_{j}(x) \leq 0,j=1,\ldots,l \rbrace$ is convex if each $h_{i}(x)$ is affine and each $g_{j}(x)$ is convex in $C_{3}$

So far, for (1), I think I can assume $\forall x \in C_{1}, h(x)=a^{T}x+b$ for some $a \in \mathbb{R}^{n}$ and $b \in \mathbb{R}$ but I'm not 100% on where to go from there.

1.$\rightarrow$. Assume that $C_1$ is convex. Then by definition $$\sum_{i=1}^{n}\lambda_ix_i \in C_1,$$ for all $x_i \in C_1$ and nonnegative numbers $\lambda_1,\ldots,\lambda_n$ such that $\sum \lambda_i=1.$ Then $$h\big(\sum_{i=1}^{n}\lambda_ix_i\big)=0=\sum_{i=1}^{n}\lambda_ih(x_i),$$ where both sides are equal to zero due to the definition of $C_1$ and the fact that $x_i \in C_1$ as well as $\sum_{i=1}^{n}\lambda_ix_i \in C_1$. So $h$ is affine (check in wikipedia the alternative definition of affineness. I use it in the next direction).
2.$\leftarrow$. Assume $h$ is affine. Then by definition $$h\big(\sum_{i=1}^{n}\lambda_ix_i\big)=\sum_{i=1}^{n}\lambda_ih(x_i),$$ for all $x_i \in C_1$ and nonnegative numbers $\lambda_1,\ldots,\lambda_n$ such that $\sum \lambda_i=1.$ Then $$h\big(\sum_{i=1}^{n}\lambda_ix_i\big)=\sum_{i=1}^{n}\lambda_ih(x_i)=\sum_{i=1}^{n}\lambda_1\cdot0=0,$$ Thus,$\sum_{i=1}^{n}\lambda_i(x_i) \in C_1$ and therefore $C_1$ is convex.
• So, I would think that to start off for (1), you'd have to start with the affineness assumption first? As in prove convexity by using $h(x)$'s affine nature? – helposaurus Feb 22 '14 at 21:51
• I guess so, yeah, I just read the problem as: show that the set $C_{1}$ is convex if and only if $h(x)$ is affine in $C_{1}$. Which in my mind just means start with showing convexity, sorry, I'm a newb here hah – helposaurus Feb 22 '14 at 23:48