The following is an exercise from a test. I didn't solve it.
Let $U$ be a compact, polyhedral set in $\mathbb R^n$ with vertices $u_1, u_2, \dots, u_n$, $A$ an $m \times n$ matrix and $b \in \mathbb{R}^{m}$, $c \in \mathbb{R}^n$. Let's define $f: \mathbb{R}^m \to \mathbb{R}$.
$$f(x) = \max_{u \in U} c^T u + x^T \left( A u - b \right)$$
a) Show that $f$ is convex.
b) Characterize the subgradient of $f$.
As for part a) I rearranged $f$ to$$f(x)=\max_{u\in U}(c^T+x^TA)u-x^Tb$$, now I think because the expression inside is linear the maximum will be attained at one of the vertices depending on $x$, $u_i(x)$, but I might be wrong, anyway help appreciated.