text: Q:
  
  Determine whether cost function is linear
  
  I started to learn linear programming with the introductory book by Matousek and Gärtner. In this book, the authors discuss in Chapter 2 several examples.
  In one example, the authors state that the cost function
  $$50\sum_{i=1}^{12} |x_i - x_{i-1}| + 20 \sum_{i=1}^{12} s_i$$
  is not linear, but can be transformed to a linear function. Unfortunately, I fail to see how one can determine whether a function is linear or not without plotting its graph. Likewise (also from the textbook), the cost function $0.75x_1 + 0.5x_2 + 0.15x_3$ is linear, but does not follow the simple form $y=mx+b$.
  
  A:
  
  Suppose you have a function $f$ whose linearity you're trying to determine. A function is linear if it has the following two properties:
  1) Additivity: $f(x + y) = f(x) + f(y)$
  2) Homogeneity of degree 1: $f(αx) = αf(x)$ for all $α$
  
  Let's see if the example you gave at the end is linear, without plotting it. Let $\mathbb x = [x_1, x_2,x_3]$, so that 
  $f(\mathbb x) = 0.75x_1 + 0.5x_2 + 0.15x_3$
  1) Does it satisfy additivity? That is, for $\mathbb y = [y_1,y_2,y_3]$, is it true that:
  $f(\mathbb x + \mathbb y) = f(\mathbb x) + f(\mathbb y)  = 0.75x_1 + 0.5x_2 + 0.15x_3 + 0.75y_1 + 0.5y_2 + 0.15y_3$?
  2) Does it satisfy homogeneity of degree 1? That is, does $f(\alpha \mathbb x) = \alpha f(\mathbb x)$ for all $\alpha$?
  If (1) and (2) hold, then $f$ is linear by definition. Can you show that they hold?
  Reference
  
  