# How to find number of maps from set $A$ to set $B$

I was trying to solve the following question:

• For two sets $A$ and $B$ of cardinalities $3$ and $2$, how many maps from $A$ to $B$ exist?

• the correct answer: $8$

But I don't see why it is $8$. Please anyone explain. Also here, what does map means?

• For each element of $A$ you can choose any image in $B$. So (where $|A|$ and $|B|$ are the respective cardinalities/sizes of these sets) there are altogether $|B|^{|A|}$ possibilities for maps. Does this require further explanation? – hardmath Jul 19 '17 at 5:26

## 2 Answers

First of all, map is another way of saying function, a relation between A and B such that each element in A is connected to only one element in B.

Select an element from the set A, let's call it a. The map must connect a to one of the elements of B, so there are 2 choices for a. Since a is arbitrary, there are 2 choices for each element.

Therefore, first we select an element from B for a, then we select an element from B for the second element of A, and then the third one. As a result, there are

## 2 x 2 x 2 = $2^3$

different maps from A to B.

• Thanks @Atakan Büyükoğlu. But i found 6 maps.For example if set A={a,b,c} and set B={x,y} then relation from A to B are {a,x}, {a,y}, {b,x}, {b,y}, {c,x}, {c,y} total 6? please help.thanks – user5005768 Jul 19 '17 at 5:43
• @user5005768: There you're counting pairs of elements from $A$ and $B$, not maps from $A$ to $B$. For example, one of the $8$ maps you should be counting is $\{a\mapsto y,b\mapsto x,c\mapsto x\}$. – hmakholm left over Monica Jul 19 '17 at 5:49
• Thanks @ Henning Makholm are you saying these are the 8 maps : {a↦x,b↦x,c↦x} {a↦x,b↦x,c↦y} {a↦x,b↦y,c↦x} {a↦x,b↦y,c↦y} {a↦y,b↦x,c↦x} {a↦y,b↦x,c↦y} {a↦y,b↦y,c↦x} {a↦y,b↦y,c↦y} please reply – user5005768 Jul 19 '17 at 6:05
• @user5005768: Yes. – hmakholm left over Monica Jul 19 '17 at 6:06

The set $A$ has $3$ elements. If $f$ is a map from $A$ to $B$, then, since $B$ has two elements, for each element $a\in A$, you have two possibilities for $f(a)$. So, you have $2\times2\times2=8$ ways of defining $f$.

• thanks @José Carlos Santos what does map means? and if i found map from B to A, then will it be 3x3 = 9 – user5005768 Jul 19 '17 at 5:32
• @user5005768 I don't understand your question. But, yes, the number of maps from $B$ to $A$ is $3^2=9$. – José Carlos Santos Jul 19 '17 at 5:34