affine function definition If we define the affine function as
$f(\lambda x  + (1-\lambda)y) = \lambda f(x) + (1-\lambda)f(y)$ for every 
$x,y \in R^d$ and $\lambda \in R$
How to show that it is equivalent to the definition 
$f(x) = Ax +f(0) $
for some $k\times d$ matrix $A$
Thank you! 
 A: $(\Longrightarrow)$ Suppose first that $f(\lambda x + (1-\lambda)y) = \lambda f(x) + (1-\lambda) f(y)$ for all $x, y \in \mathbb{R}^d$ and $\lambda \in \mathbb{R}$.  Let $$g(x) = f(x) - f(0).$$  We have to show that $g$ is linear.  This means that we have to check that


*

*$g(cx) = cg(x)$ for all $x \in \mathbb{R}^d$ and $c \in \mathbb{R}$.

*$g(x+y) = g(x) + g(y)$ for all $x, y\in \mathbb{R}^d$
For the first point, note that $$g(cx) = f(cx) - f(0)$$ by definition.  Also, our hypothesis gives $f(cx) = cf(x) + (1-c)f(0)$ (by taking $\lambda = c$ and $y = 0$).  You take it from here.
For the second point, note that $$g(x + y) = f(x+y) - f(0)$$ by definition.  Also, our hypothesis gives $f(x+y) = \frac{1}{2}f(2x) + \frac{1}{2}f(2y)$ (why?) and that $f(2x) = 2f(x) - f(0)$ (why?).  You take it from here.

$(\Longleftarrow)$ Suppose now that $f(x) = Ax + f(0)$ for some $k \times d$ matrix $A$.  If $x,y \in \mathbb{R}^d$ and $\lambda \in \mathbb{R}$, then
$$
\begin{align*}
f(\lambda x + (1-\lambda)y) & = A(\lambda x + (1-\lambda)y) + f(0) \\
& = \ldots \\
& = \ldots \\
& = \lambda f(x) + (1-\lambda) f(y),
\end{align*}$$
where the $\ldots$ means I've left the details for you to fill in.
