> #Weiji Zheng, 09/27/2020, Assignment 5 ; > #OK to post homework ; > ; > #Q1 ; > #Prove p(n) = n*p(n-1) where P(n) is broken-up to sets ; > #P(1)=[{1}] ; > #P(2)=[{12},{21}] ; > #P(3)=[{123},{132},{213},{231},{312},{321}] ; > #We have P_j[n]={All permutations pi in P(n) such that that pi[1]=j, j=1..n} ; > #For example, P_1[2] = All permutations pi in P(2) such that that pi[1]=1 ; > ; > #So we have ; > #P_1[3] = [{312},{321}] IN BIJECTION WITH [{12},{21}] P[2] ; > #P_2[3] = [{132},{231}] IN BIJECTION WITH [{12},{21}] P[2] ; > #P_3[3] = [{123},{213}] IN BIJECTION WITH [{12},{21}] P[2] ; > #P_j[n] IS IN BIJECTION WITH P[n-1] ; > ; > #Then ; > #|P_j[n]| = |P_[n-1]| for j = 1,2,3,...,n ; > #|P[n]| = |P_1[n] union P_2[n] union ... P_n[n]| = |P_1[n]| + ... +|P_n[n]| ; > #|P[n]| = |P[n-1]|+ ... + |P[n-1]| = n*|P(n-1)| = n*(n-1)*|P[n-2]|=... ; > #Since p[0] = 1,we get ; > #p[n] = n*p[n-1] = n! ; > ; > #Q2 ; > #P(1;1,2,3) = {1} p(1)=1 ; > #P(2;1,2,3) = {11,2} p(2) = 2 ; > #P(3;1,2,3) = [3,{1+P(2)},{2+P(1)}] = [3,111,12,21} p(3) = 4 ; > #P(4;1,2,3) = [{1+P(3)},{2+P(2)},{3+P(1)}] = [12,1111,112,121,22,211,3] p(4) = 7 ; > #So, for P(n;1,2,3),we have p(n) = |P(n;1,2,3)| = ; > #p(n-1)+p(n-2)+p(n-3) ; > ; > #Then for p(n;a1,a2,a3) we can conclude p(n) = p(n-a1)+p(n-a2)+p(n-a3) where p(n) = 1 when n = 0 and p(n) = 0 when n < 0 ; > ; > #Q3 ; > #Write a Maple procedure (don't forget to use option remember)SEQP(a1,a2,a3,N) That inputs a1,a2,a3, as above, and a positive integer N, and outputs the first N+1 terms, starting at n=0 of p(n,a1,a2,a3), n=1..N ; > ; > #Sorry, Dr.Z, it's so hard. ; > ; > #Q4 ; > ; > #this person is in C and L, not in S an K ; > #So ; > #Line1 ; > #this person is included for 2 times -> |C| and |L| ; > #Line2 ; > #this person is excluded for 1 times -> |C interset L| ; > #Line3 ; > #this person is included for 0 time ; > #Line4 ; > #this person is excluded for 0 time ; > ; > ; > #this person is in C and L, S an K ; > #So ; > #Line1 ; > #this person is included for 4 times -> |C| and |L| and |S| and |K| ; > #Line2 ; > #this person is excluded for 6 times -> |C interset S|,|C interset L|,|C interset K|,|S interset L|,|S interset K|,|L interset K| ; > #Line3 ; > #this person is included for 4 time -> |C interset S intersect L|,|C interset S intersect K|,|C interset K intersect L|,|S interset K intersect L| ; > #Line4 ; > #this person is excluded for 1 time -> |C intersect S intersect L intersect K| ; > ;