(Equation of Jensen) Find the continuous functions $f: \mathbb{R} \rightarrow \mathbb{R}$ such that for all $x, y$,

$$
f\left(\frac{x+y}{2}\right)=\frac{f(x)+f(y)}{2}
$$
A search for solutions reveals that all affine functions $f(x)=a x+b$ are solutions. Let's now show that these are the only ones.

Let $f(0)=b$ and $f(1)=a+b$ (to remain in the form $a x+b$). By taking $x=0$ and $y=2$, we calculate that $f(2)=2 a+b$. Then, by taking $x=1, y=3$, $f(3)=3 a+b$. A simple induction then gives $f(n)=a n+b$ for all $n \in \mathbb{N}$. By taking $x=n, y=-n$, we also find $f(-n)=-a n+b$. The equation $f(x)=a x+b$ is therefore true for all $x \in \mathbb{Z}$.

Now let's tackle $\mathbb{Q}$. We want to calculate $f\left(\frac{p}{q}\right)$. Let's first set $f\left(\frac{1}{q}\right)=b+c$. An induction similar to the previous paragraph gives $f\left(\frac{k}{q}\right)=b+k c$. In particular, $f\left(\frac{q}{q}\right)=b+q c$, but $f\left(\frac{q}{q}\right)=f(1)=a+b$, so $c=\frac{a}{q}$, and we have $f\left(\frac{p}{q}\right)=a \frac{p}{q}+b$. The equation $f(x)=a x+b$ is now true for all $x \in \mathbb{Q}$.

There is still $\mathbb{R}$ to consider, for which we use the continuity of $f$. Let $x \in \mathbb{R}$ and let $\left(r_{n}\right)$ be a sequence of rationals that tends to $x$. By the continuity of $f$:

$$
\begin{aligned}
& f(x)=\lim _{n \rightarrow \infty} f\left(r_{n}\right) \\
& f(x)=\lim _{n \rightarrow \infty}\left(a r_{n}+b\right) \\
& f(x)=a x+b
\end{aligned}
$$

The only solutions are therefore the affine functions.