```markdown
### Pointwise Maximum

If \( f_1, \ldots, f_m \) are convex, then \( f(x) = \max\{f_1(x), \ldots, f_m(x)\} \) is convex.

#### Examples

- **Piecewise-linear function**:  
  \( f(x) = \max_{i=1,\ldots,m}(a_i^T x + b_i) \) is convex.

- **Sum of \( r \) largest components of \( x \in \mathbb{R}^n \)**:  
  \[
  f(x) = x_{[1]} + x_{[2]} + \cdots + x_{[r]}
  \]
  is convex (\( x_{[i]} \) is the \( i \)-th largest component of \( x \)).

#### Proof:

\[
f(x) = \max\{x_{i_1} + x_{i_2} + \cdots + x_{i_r} \mid 1 \leq i_1 < i_2 < \cdots < i_r \leq n\}
\]
```
