Affine and Linear functions I'm taking a course in optimisations and I read this

[A gentle introduction to opimisation]
My question is about the 3rd function in Example 1. Is it possible to write that as a linear (affine) function by declaring a new variable $$x_5=x_3*x_4$$
I understand that would add a new contraint but who cares? Is this now linear? (I don't think it's linear because constraint is not linear) Or is it affine but not linear
 A: Yes! If you are willing to drop both $x_3$ and $x_4$ out of the picture, then yes, the problem
$$
f(x_1, x_2, x_5) = 3x_1 + x_2 - 6x_5
$$
is indeed linear. BUT, it is important to note that the problem now does not depend on neither $x_2$ nor $x_3$.
The problem in doing that is another one, once you optimize $f$ and find an optimal value of $x_5$, say $x_5 = 1$, you have now the issue $x_3 x_4 = 1$, which does not have a unique solution
A: No, it's NOT!! To talk about affine functions, you must clearly state its domain (input), mapping rule (function) and the output. While linear transformations preserve the linearity, nonlinear transformations usually don't!! 
The new mapping your proposed, $f(x1,x2,x5)=3x_1+x_2−6x_5$ is a new function, and its link to the original function is a nonlinear transformation. Here is another example that makes it clear: think about a real function F1 $f(x)=x^2$. It's nonlinear, and clearly not an affine function. F2 $f(y)=y$ is an affine function. You can covert F1 to F2 via $y=x^2$. However, if you treat $x$ as the input, the function is nonlinear and clearly not an affine function.
A: The definition of an affine function does not mention any constraint, it is important that $f(x)=\alpha^Tx+\beta$ for all $x\in{\Bbb R}^n$. In your case, the function looks like linear on the set $x_3x_5=x_6$, but what happens outside the set?
Take a simpler one dimensional example: $f(x)=x^2$. Set $y=x^2$ and rewrite $f(x,y)=y$. It looks like a linear function, but it is not linear since $f(x,y)=y$ only on the parabola $y=x^2$, not on the whole plane $(x,y)\in{\Bbb R}^2$.
