Solution 1:

A set $S$ is convex iff for every pair of points $x,y\in S$, the line segment $\overline{xy}$ joining $x$ to $y$ is a subset of $S$. $S$ is affine iff for every pair of points $x,y\in S$, the whole infinite line containing $x$ and $y$ is a subset of $A$. In the xy-plane, for instance, $S=\{(x,0):0\le x\le 1\}$ is a convex set but not an affine set: the smallest affine set containing $S$ is the whole $x$-axis.

Mathematically, $S$ is affine iff it contains every affine combination of its points, where an affine combination of the points $x_1,\dots,x_n\in S$ is any point of the form $$a_1x_1+a_2x_2+\cdots+a_nx_n$$ such that $$a_1+a_2+\cdots+a_n=1\;.$$

$S$ is convex iff it contains every convex combination of its points. Convex combinations are the special case of affine combinations in which all of the coefficients are non-negative. That is, a convex combination of the points $x_1,\dots,x_n\in S$ is any point of the form

$$a_1x_1+a_2x_2+\cdots+a_nx_n$$ such that $$a_1+a_2+\cdots+a_n=1$$ and $$a_1,a_2,\dots,a_n\ge 0\;.$$

You can think of a convex combination of points as a kind of weighted average of those points; an affine combination is then a weighted ‘average’ in which some of the weights are allowed to be negative. In particular, $$\{ax+by:a+b=1\text{ and }a,b\ge 0\}$$ is simply the set of points on the line segment from $x$ to $y$; the point $ax+yb$ is $b$ fraction of the way from $x$ to $y$. The set

$$\{ax+by:a+b=1\}\;,$$

on the other hand, includes the whole line through $x$ and $y$. The point $-x+2y$, for instance, does not lie between $x$ and $y$: instead, $y$ is between $x$ and $-x+2y$.

Solution 2:

You have got everything wrong. Check it here. http://homepages.rpi.edu/~mitchj/handouts/affine/.

In fact, every affine set is convex and not vice versa.