# Counting the number of odd and even functions.

Was just brushing up on counting functions and ran into this problem:

Let A and B be defined as follows

$$A:=\{-3,-2,-1,0,1,2,3\}, B:= \{0,1\},$$

how many odd and even functions $f:A$->$B$ are there?

Now I know the number of injective, surjective and bijective functions there are with no problem, but got a bit stuck when considering odd/even. I know the respective defintions of what it means for a function to be odd and even, but that's as far as my knowledge goes in an attempt to solve this problem. Could obviously list all the possibilities out, but I feel there surely must be a more elegant combinatorial way to do this.

EDIT: A function $f$ is even if $f(-a)=f(a)$ for all $a$ in the domain of $f$ and a function $f$ is odd if $f(-a)=-f(a)$ for all $a$ in the domain of $f$.

EDIT (2): I have listed out the possible functions as sequences here and find that, for the number of even functions, it's the total number of these sequences divided by 2. Is this true in a general case?

• What do you think "odd" and "even" mean?
– lulu
Commented Oct 15, 2017 at 15:16
• I don't think the words "odd" and "even" mean what my best guess is here. Commented Oct 15, 2017 at 15:16
• The definition I am familiar with for odd and even functions are for functions of a real variable, where odd means $f(-x)=-f(x)$. Please define even and odd functions in this context. Commented Oct 15, 2017 at 15:19
• I see the edit, but it does not make sense. There is no notion of $-a$ for an element $a\in A$ in your case.
– lulu
Commented Oct 15, 2017 at 15:21
• @lulu ah right of course, thanks. then i should extend $A$ so it includes negative numbers. Commented Oct 15, 2017 at 15:23

For the original question where $A=\{0,1,2,3\}$:
Given the definition of even and odd, note that the only case that you have both $a$ and $-a$ in the domain is $a=0$. A function will be odd if it sends $0$ to $0$. It will always be even.

When $A$ is extended to include the negatives, note that $-1$ is not part of the range, so the only odd function is the zero function. For an even function, you can choose $f(0)$ through $f(3)$ as you wish, $2^4$ possibilities, then $f(-1)$ through $f(-3)$ are defined, so there are $16$. Your edit 2 is not correct. There are $128$ sequences, so only $\frac 18$ of the sequences are even functions.

• my apologies, i realise that $A$ needs to include negative numbers for the question to make more sense. Commented Oct 15, 2017 at 15:24
• No, it makes sense even if the negative numbers are not included. Even and odd then put very little constraint on the function, but you can apply the definition. Commented Oct 15, 2017 at 15:25
• For the odd option, the condition doesn't apply for $0$, since there is no f(-0), neverthless, just one function is valable which maps all the elments to $0$, which means there is just 2 functions depending just on the role of f(0) am I right? Commented Nov 23, 2017 at 14:01
• @Idle: that is correct. Commented Nov 23, 2017 at 15:01

It should be clear that there can only be one odd function, with all zeroes.

Then for an even function, only four function values are independent (say for $x\ge0$), and the three others follows. Hence $2^4$ functions.