Assignment
Assignment
Belema Debela
netID bjd8427
Task 1. Counting Paths [6 points]
Solution
To see the patterns of the allowable route let see some possible routes one can choose,
Right, Up, Right, Up, Up, Right, Right, Up,Right
Right, Up, Right, Up, Right, Right, Up,Right, Up
Right, Right, Up, Up, Right, Right, Up,Right, Up
So, as you can see for all routes we have nine decisions to make and the number of Right is 5.
We have 9 option to put the first Right move, 8 options for the second Right, 7 for the next
and etc. But we know that the first Right,the second and all Right are same. Hence we use
combination instead of permutation. Hence 9C5=126 is the solution.
Assume you have a bowl containing candies: 50 cherry, 50 strawberry, 40 orange, 70 lemon, and
40 pineapple. Assuming that the pieces of each flavor are identical,
(b) How many handfuls of 15 are possible with at least one piece of each flavor?
(c) How many handfuls of 15 are possible with at least two pieces of each flavor?
(d) How many handfuls of 15 are possible with at least three pieces of each flavor?
In all cases, explain how you derived your answer. Providing the final results only is not enough.
Solution
To solve this problem, we can use combinations with repetition, which is a concept from combi-
natorics. We’ll calculate the number of ways to choose 15 candies from each flavor, considering
different constraints for each part of the question.
Let’s denote the number of candies of each flavor as follows:
- Cherry: C = 50 - Strawberry: S = 50 - Orange: O = 40 - Lemon: L = 70 - Pineapple: P = 40
(a) How many handfuls of 15 are possible? For this part, we need to find the number of
combinations of 15 candies without any constraints.
We can use the formula for combinations with repetition:
C(n + r − 1, r)
where n is the number of types of candies and r is the number of candies chosen.
So, for 5 types of candies and choosing 15 candies, the number of combinations is:
n!
C(n, k) =
k!(n − k)!
Using this formula, we get:
19! 19!
C(19, 15) = =
15!(19 − 15)! 15!4!
19 × 18 × 17 × 16
C(19, 15) =
4×3×2×1
C(15, 15) × 5 = 1 × 5 = 5
3876 − 5 = 3871
So, there are 3871 possible handfuls of 15 candies with at least one piece of each flavor.
(c) How many handfuls of 15 are possible with at least two pieces of each flavor? For this part,
we’ll use a similar approach as in part (b), but we’ll account for the cases where only one piece
of one or more flavors is chosen.
Total possible handfuls - Handfuls with at least one flavor chosen once - Handfuls without at
least one of each flavor
Total possible handfuls: 3876
Handfuls with at least one flavor chosen once:
C(15, 14) × 5 = 15 × 5 = 75
3876 − 75 − 5 = 3796
So, there are 3796 possible handfuls of 15 candies with at least two pieces of each flavor.
(d) How many handfuls of 15 are possible with at least three pieces of each flavor? For this
part, we’ll again use a similar approach, considering the cases where one or two pieces of one
or more flavors are chosen.
Total possible handfuls - Handfuls with at least one flavor chosen once - Handfuls with at least
one flavor chosen twice - Handfuls without at least one of each flavor
Total possible handfuls: 3876
Handfuls with at least one flavor chosen once: 75
Handfuls with at least one flavor chosen twice:
(b) How many injective (one-to-one) functions from E to F exist? Explain your answer.
(c) How many bijective (injective and surjective) functions from E to F exist? Explain your
answer.
(d) Let n ∈ N. How many surjective (onto) functions exist from Nn to N2 , where N2 = {0, 1}
and Nn = {0, 1, . . . , n − 1}? Explain your answer.
Solution
Let’s address each part of the problem one by one:
(a) How many functions from E to F exist?
A function from set E to set F assigns each element of E to exactly one element of F . Since
there are m choices for each element of E (each element can be mapped to any element of F ),
and there are n elements in E, the total number of functions from E to F is mn .
(b) How many injective (one-to-one) functions from E to F exist?
An injective function is one where each element of E is mapped to a distinct element of F . This
means that no two elements of E are mapped to the same element of F .
To count the number of injective functions, we need to select n distinct elements from F to map
to the n elements of E. This can be calculated as P (m, n), the number of permutations of m
items taken n at a time.
(c) How many bijective (injective and surjective) functions from E to F exist?
A function is bijective if it is both injective and surjective. From (b), we know there are P (m, n)
injective functions. For a function to be surjective, each element of F must be mapped to by
at least one element of E. Since there are n elements in E, all of which are mapped to different
elements in F , the function is surjective.
So, the number of bijective functions from E to F is equal to the number of injective functions,
which is P (m, n).
(d) Let n ∈ N. How many surjective (onto) functions exist from N n to N 2 , where N 2 = {0, 1}
and N n = {0, 1, ..., n − 1}?
For a function to be surjective, every element in the codomain (N 2 ) must be mapped onto by
at least one element in the domain (N n ). Since N 2 has only 2 elements, both 0 and 1, we need
to ensure that both 0 and 1 are mapped onto.
We can count the number of surjective functions by using the principle of inclusion-exclusion.
We count all functions (2n ) and subtract the ones that do not cover both 0 and 1.
The functions that do not cover 0 and 1 are those that map all elements of N n to only one
element of N 2 . There are 2 such functions. So, the number of surjective functions is 2n − 2.
(1 + x)m · (1 + x)n .
Solution
Let’s address each part of the problem: Pk
(a) **Combinatorial Proof:** The identity states that m+n = i=0 mi k−i
n
k .
Imagine we have two sets of objects: set M with m objects and set N with n objects. We want
to choose k objects from the union of sets M and N .
On the left-hand side, m+n
k represents the number of ways to choose k objects from the
combined set of m + n objects.
On the right-hand side, ki=0 mi k−i
P n
represents the sum of the ways to choose i objects from
set M and k − i objects from set N , for i from 0 to k.
The sum over i accounts for all possible ways of partitioning the k chosen objects between sets
M and N .
Therefore, both sides of the identity represent the same count of ways to choose k objects from
the union of sets M and N , proving the identity by combinatorial reasoning.
(b) **Proof using Generating Functions:** Consider the expansion of (1 + x)m · (1 + x)n .
Each term in the expansion is of the form xi where i ranges from 0 to m + n. The coefficient
of xi in the expansion represents the number of ways to choose i objects from the union of sets
M and N .
Expanding (1 + x)m · (1 + x)n yields (1 + x)m+n , and the coefficient of xi in this expansion is
m+n
i .
On the other hand, each term in the expansion of (1 + x)m · (1 + x)n can also be obtained by
multiplying the corresponding terms from the expansions of (1+ x)m and (1 + x)n .
The term xi in the expansion of (1 + x)m has coefficient mi , and the term xm+n−i in the
n
expansion of (1 + x)n has coefficient m+n−i .
Therefore, the coefficient of x in the product (1 + x)mP· (1 + x)
i n
nis the sum of the product of
k m
these coefficients over all possible values of i, which is i=0 i k−i .
Thus, by equating the coefficients of xi in both expansions, we prove the identity.
(c) **Using (a) to show another identity:** Starting from m+n
n , we can use the identity
derived in part (a) with k = n, which gives:
n
m+n X m n
=
n i n−i
i=0
n
is the same as ni (because nk = n−k
n
Now, notice that n−i ).
So, we have:
Xn
m+n m n
=
n i i
i=0
n 2
This expression looks similar to what we want to prove: n ni=0
P
i .
So, if we set m = n in the equation derived from (a), we get:
n
n+n X n n
=n
n i n−i
i=0
Which simplifies to:
n 2
2n X n
=n
n i
i=0
Pn n 2 2n
This proves the identity i=0 i = n using the result from part (a).