Let $n,m$ be positive integers such that $n<m$ and $a_1, a_2, ..., a_m$ be different real numbers.
(a) Find all polynomials $P$ with real coefficients and degree at most $n$ such that:
$|P(a_i)-P(a_j)|=|a_i-a_j|$ for all $i,j=\{1, 2, ..., m\}$ such that $i<j$.
(b) If $n,m\ge 2$ does there exist a polynomial $Q$ with real coefficients and degree $n$ such that:
$|Q(a_i)-Q(a_j)|<|a_i-a_j|$ for all $i,j=\{1, 2, ..., m\}$ such that $i<j$
Edit: See #3
### Part (a)

1. **Assume the order of \(a_i\):**
   Without loss of generality, let \(a_1 < a_2 < \cdots < a_m\). The given condition is:
   \[
   |P(a_i) - P(a_j)| = |a_i - a_j| \quad \text{for all } i, j \in \{1, 2, \ldots, m\} \text{ such that } i < j.
   \]

2. **Sum of absolute differences:**
   Consider the sum of the absolute differences:
   \[
   \sum_{i=1}^{m-1} |P(a_{i+1}) - P(a_i)| = \sum_{i=1}^{m-1} (a_{i+1} - a_i) = a_m - a_1 = |P(a_m) - P(a_1)|.
   \]

3. **Triangle inequality:**
   By the triangle inequality, we have:
   \[
   \sum_{i=1}^{m-1} |P(a_{i+1}) - P(a_i)| \geq \left| \sum_{i=1}^{m-1} (P(a_{i+1}) - P(a_i)) \right| = |P(a_m) - P(a_1)|.
   \]
   Equality holds if and only if all the terms \(P(a_{i+1}) - P(a_i)\) have the same sign, i.e., either \(P(a_{i+1}) - P(a_i) > 0\) for all \(i\) or \(P(a_{i+1}) - P(a_i) < 0\) for all \(i\).

4. **Case analysis:**
   - If \(P(a_{i+1}) - P(a_i) > 0\) for all \(i\), then \(P(a_i) - P(a_j) = a_i - a_j\) for all \(i, j \leq m\). This implies:
     \[
     P(a_i) - a_i = P(a_j) - a_j = c \quad \text{(constant)}.
     \]
     Therefore, \(P(x) - (x + c)\) has \(m\) roots, and since \(\deg(P) \leq n < m\), \(P(x) - (x + c)\) must be the zero polynomial. Hence, \(P(x) = x + c\).

   - Similarly, if \(P(a_{i+1}) - P(a_i) < 0\) for all \(i\), then \(P(a_i) - P(a_j) = -(a_i - a_j)\) for all \(i, j \leq m\). This implies:
     \[
     P(a_i) + a_i = P(a_j) + a_j = d \quad \text{(constant)}.
     \]
     Therefore, \(P(x) - (-x + d)\) has \(m\) roots, and since \(\deg(P) \leq n < m\), \(P(x) - (-x + d)\) must be the zero polynomial. Hence, \(P(x) = -x + d\).

5. **Conclusion for part (a):**
   The solutions are \(P(x) = x + c\) or \(P(x) = -x + d\).

### Part (b)

1. **Existence of polynomial \(Q\):**
   Let \(Q(x) = cx^n\) where \(c\) is an arbitrarily small positive constant. We need to check if:
   \[
   |Q(a_i) - Q(a_j)| < |a_i - a_j| \quad \text{for all } i, j \in \{1, 2, \ldots, m\} \text{ such that } i < j.
   \]

2. **Evaluate the condition:**
   \[
   |Q(a_i) - Q(a_j)| = |c(a_i^n - a_j^n)|.
   \]
   Since \(a_i\) and \(a_j\) are distinct and \(n \geq 2\), \(a_i^n - a_j^n\) grows faster than \(a_i - a_j\). However, by choosing \(c\) sufficiently small, we can ensure:
   \[
   |c(a_i^n - a_j^n)| < |a_i - a_j|.
   \]

3. **Conclusion for part (b):**
   Therefore, such a polynomial \(Q(x) = cx^n\) exists for sufficiently small \(c\).

The final answer is \( \boxed{ P(x) = x + c } \) or \(P(x) = -x + d\) for part (a), and \(Q(x) = cx^n\) for part (b).