Proof that a set $C$ is convex $\iff$ its intersection with any line is convex

Solution 1:

So your proof is correct, but a little confusing -- especially the second part. It's easier to do directly instead of via contradiction. A little simplification:

$\Leftarrow$: Let $x,y\in C$ and let $\lambda\in[0,1]$. We wish to prove $\lambda x + (1-\lambda)y\in C$.

Let $L$ be the line through $x$ and $y$. $x$ and $y$ are in $C\cap L$. By convexity of $C\cap L$, we have that $\lambda x + (1-\lambda)y\in C\cap L$ and hence clearly $\lambda x + (1-\lambda)y\in C$.