Show that $\max$ function on $\mathbb R^n$ is convex

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$$


Fix $k\in \{1,\ldots,n\}$. We have $$\theta x_k + (1-\theta)y_k \leq \theta \max_i x_i + (1-\theta)\max_i y_i$$ because $x_k \leq \max_i x_i$, $y_k \leq \max_i y_i$, $\theta \geq 0$ and $1-\theta \geq 0$.

Since the statement above is true for any $k$ we have:

$$\max_k [\theta x_k + (1-\theta)y_k]\leq \theta \max_i x_i + (1-\theta)\max_i y_i.$$


One line proof:

Since composition of convex functions is convex, we only need to show $\max{(x,y)}$ is convex. But $\max(x,y)=\frac{x+y}{2}+|\frac{x-y}{2}|$ and $|\cdot|$ is obviously convex.