Find all functions $f: \mathbb{Q} \rightarrow \mathbb{Q}$ such that for all real numbers $x, y$:

$$
f\left(\frac{x+y}{2}\right)=\frac{f(x)}{2}+\frac{f(y)}{2}
$$

## Solutions to the exercises
We notice that if $f$ is a solution, then for any constant $c \in \mathbb{R}, f+c$ is also a solution. By replacing $f$ with $g: x \mapsto f(x)-f(0)$, we can assume that $f(0)=0$. Setting $y=0$, we then get $f\left(\frac{x}{2}\right)=\frac{f(x)}{2}$. The initial equation can then be rewritten as $\frac{f(x+y)}{2}=\frac{f(x)}{2}+\frac{f(y)}{2}$, or $f(x+y)=f(x)+f(y)$. We have thus recovered Cauchy's equation, whose solutions are linear functions. Finally, the solutions to the initial equation are affine functions, which we can verify satisfy the equation.

## Injectivity, Surjectivity, and Bijectivity

We now introduce the essential notions of injective, surjective, and bijective functions. These are properties that we can try to deduce from the statement to gain clues about the solutions.

Definition 2. A function is said to be injective if the images of two distinct elements under $f$ are distinct. In other words, if $a$ and $b$ belong to the domain of $f$ and $a \neq b$, then $f(a) \neq f(b)$. Thus, every element in the codomain has a unique preimage.

Definition 3. A function is said to be surjective if every element in the codomain has at least one preimage. In other words, if $f: A \rightarrow B$, then for every $y \in B$ there exists an $x \in A$ such that $f(x)=y$.

Definition 4. A function is said to be bijective if it is both injective and surjective.

## Remark 5.

A function is therefore bijective if every element in the codomain has a unique preimage.

## Remark 6.

To show that a function is injective, we often use the contrapositive: we show that if two elements $a$ and $b$ satisfy $f(a)=f(b)$, then $a=b$.

## Remark 7.

To show that a function is surjective, we generally try to reduce it to an equation of the form $f(A)=B$, where $A$ and $B$ are expressions that depend on a variable $x$. If $B$ covers the entire codomain of $f$ as $x$ ranges over the same set, then $f$ is surjective.