I am reading the book Convex Optimization, and I don't understand why a $\max$ function is convex.
The function is defined as:
$$f(x) = \max(x_1, x_2, \dots, x_n)$$
The book offers the proof shown below:
for $0 \leq \theta \leq 1$
$$\begin{aligned} f(\theta x + (1 - \theta)y) &= \max_i \left( \theta x_i + (1 - \theta)y_i \right)\\ & \leq \theta \max_i x_i + (1 - \theta)\max_i y_i\\ &= \theta f(x) + (1 - \theta)f(y) \end{aligned}$$
However, I don't understand why the following inequality holds.
$$\max_i (\theta x_i + (1 - \theta)y_i) \leq \theta \max_i x_i + (1 - \theta)\max_i y_i$$