How to prove that a function is affine? I am trying to understand the concept of affinity of functions. First, I thought that every affine function has to be a linear function, too, because my teacher's notes define linear and affine functions as follows:
$$ T(\sum_{i=0}^n \alpha_iu_i) = \sum_{i=0}^n\alpha_iT(u_i) $$
is a linear function. An affine function is defined as $ T(\sum_{i=0}^n \alpha_iu_i) $ with $ \sum_{i=0}^n \alpha_i = 1 $ and the above condition of a linear function. 
Then, I found the example of $ f(x) = 2x + 3 $ which is an affine function but not linear which is pretty confusing to me (I understand why it is not linear, but have no clue as to why it is affine according to the definitions).
I also have to solve a problem such as:
$$ T: \mathbb{R} \to \mathbb{R},  T(x,y,z) := (x − z + 1, y - 5, z - y, 2) $$
but I really have no idea how to proof if it's affine or not. There are no $ \alpha $ and that function is not linear, so I am kind of stuck here. 
I appreciate any sort of help, like links to websites or anything that helps me to understand this because I have no strategy to solve this problem.
 A: A function is affine iff $T(\lambda x + (1-\lambda) y) = \lambda T(x) + (1-\lambda) T(y)$ for all $x,y$ and $\lambda \in \mathbb{R}$.
It is straightforward to show that the above definition is the same as the one in the question.
You can use this to answer your question by checking that
$T(\lambda (x_1,y_1,z_1) + (1-\lambda)(x_2,y_2,z_2)) = \lambda T((x_1,y_1,z_1)) + (1-\lambda)T((x_2,y_2,z_2))$ for any scalar $\lambda$.
Also, note that if $T$ is affine and we let $L(x) = T(x)-T(0)$, then
$L(\lambda x) = T(\lambda x) - T(0) = T (\lambda x + (1-\lambda) 0) - T(0) =\lambda T(x)+(1-\lambda) T(0) - T(0) = \lambda L(x)$,
and
$L(x+y) = 2 L({1 \over 2} (x+y))= 2 T({1 \over 2} (x+y)) - 2T(0)= 2( {1 \over 2}(T(x)+T(y)))-2 T(0) = L(x)+L(y)$.
Hence $L$ is linear, and we can write $T(x) = T(0)+L(x)$.
It is easy to check that if $L$ is linear and $c$ is a constant vector, then $T(x) = L(x)+ c$ is affine.
So we see that $T$ is affine iff it can be written as a constant plus a linear function.
In your case, we see that we can write $T((x,y,z)) = A (x,y,z)^T + b$
for some matrix $A$ and some vector $b$.
A: Every affine function is a linear function "plus a constant vector".  That is, for every affine function $A(x)$, there is a vector $v$ and a linear function $T(x)$ such that $A(x)=T(x)+v$.
What is the difference between linear and affine function
