Can there be a function that's even and odd at the same time?

Others have mentioned that $f(x)=0$ is an example. In fact, we can prove that it is the only example of a function from $\mathbb{R}\to \mathbb{R}$ (i.e a function which takes in real values and outputs real values) that is both odd and even. Suppose $f(x)$ is any function which is both odd and even. Then $f(-x) = -f(x)$ by odd-ness, and $f(-x)=f(x)$ by even-ness. Thus $-f(x) = f(x)$, so $f(x)=0.$


If $K$ is a field of characteristic 2, every function $K\to K$ is both even and odd.


Yes. The constant function $f(x) = 0$ satisfies both conditions.

Even: $$ f(-x) = 0 = f(x) $$

Odd: $$ f(-x) = 0 = -f(x) $$

Furthermore, it's the only real function that satisfies both conditions:

$$ f(-x) = f(x) = -f(x) \Rightarrow 2f(x) = 0 \Rightarrow f(x) = 0 $$