Questions & explanations
1. A cube has 6 faces. How many distinct colorings of faces with 2 colors under rotations? Use Burnside's lemma. (Hint: Rotations of cube: identity, 90° face rotations, 180° face rotations, 120° vertex rotations, 180° edge rotations.)
Cube has 24 rotations. Identity: 2^6=64. Face rotations 90°: there are 6 faces × 3 orientations = 6? Actually 6 faces, each has 3 rotations (90°,180°,270°), but 90° and 270° are similar. For 90°: fixes 2 faces (top and bottom) and cycles 4 side faces, so fixed: top/bottom any (2^2=4), side faces must be same (2), total 4*2=8. Number of 90° rotations: 6 faces × 1 (since 90° and 270° count separately?) Actually each face has 2 non-identity rotations (90° and 270°) that are 4-cycles, so 6*2=12 such rotations. For 180° face rotations: cycles 2 pairs of side faces, fixes top and bottom, so fixed: top/bottom any (4), side faces: two pairs each same, so 2^2=4, total 16. Number of 180° face rotations: 6 faces × 1 = 6. Vertex rotations 120°: cycles 3 faces around a vertex, fixes opposite vertex? Actually 8 vertices, each has 2 non-identity rotations (120° and 240°), so 8*2=16 rotations. Each such rotation cycles 3 faces around one vertex and 3 around opposite, so fixed: all faces in each cycle same, so 2^2=4. Edge rotations 180°: cycles 2 pairs of faces, fixes 2 opposite faces? Actually 12 ed
2. Give an example of a regular language whose syntactic monoid is not commutative.
Consider the language L = {strings over {a,b} that start with a}. The minimal DFA has two states: start state q0 and accept state q1. Reading a from q0 goes to q1, reading b from q0 goes to a dead state. The transition monoid contains functions: identity (empty string), function that sends q0 to q1 and q1 to q1 (for a), function that sends q0 to dead and dead to dead (for b), etc. The monoid is not commutative because a followed by b gives a different function than b followed by a. For instance, ab sends q0 to dead, while ba sends q0 to q1 (since b from q0 goes to dead, then a from dead stays dead, but actually ba: start q0, read b -> dead, then a -> dead; ab: start q0, read a -> q1, then b -> dead? Wait, need careful: In minimal DFA, from q1 on b goes to dead. So ab: q0 -> a -> q1 -> b -> dead; ba: q0 -> b -> dead -> a -> dead. Both end in dead, but the functions differ on other states? Actually, the monoid elements are functions on all states. The function for a maps q0->q1, q1->q1, dead->dead. The function for b maps q0->dead, q1->dead, dead->dead. Then ab = a∘b? Composition order
3. Use snake oil to prove sum_{k=0}^n C(n,k)^2 = C(2n,n).
Consider S_n = sum_{k=0}^n C(n,k)^2. Define generating function A(x) = sum_{n>=0} S_n x^n. Write S_n = sum_{k>=0} C(n,k) C(n,k). Use identity C(n,k) = [x^k] (1+x)^n. Then A(x) = sum_{n>=0} sum_{k>=0} C(n,k) C(n,k) x^n. Interchange sums: = sum_{k>=0} sum_{n>=k} C(n,k) C(n,k) x^n. But C(n,k) = [y^k] (1+y)^n? Alternatively, use known generating function: sum_{n>=0} C(n,k) x^n = x^k/(1-x)^{k+1}. Then A(x) = sum_{k>=0} (x^k/(1-x)^{k+1})^2? Actually careful: sum_{n>=0} C(n,k) C(n,k) x^n is not simply product. Better: use convolution: sum_{n} C(n,k) C(n,k) x^n = ? Another approach: consider sum_{n} C(2n,n) x^n = 1/sqrt(1-4x). We can show A(x) = 1/sqrt(1-4x) by snake oil. Compute A(x) = sum_{n>=0} sum_{k=0}^n C(n,k)^2 x^n = sum_{k>=0} sum_{n>=k} C(n,k)^2 x^n. Use C(n,k) = C(n, n-k). Not simple. Actually standard proof: sum_{n} sum_{k} C(n,k)^2 x^n = sum_{k} sum_{n} C(n,k)^2 x^n. But we know sum_{n>=k} C(n,k) x^n = x^k/(1-x)^{k+1}. However C(n,k)^2 is not linear. So use generating function for C(2n,n): 1/sqrt(1-4x). Alternatively, use identity: sum_{k} C(n,k)^2 = C(2n,n). So we can prove by c
4. Explain the baby-step giant-step algorithm for discrete logarithms. Use a small example: find k such that 2^k ≡ 3 (mod 11).
The baby-step giant-step algorithm finds discrete logarithms in about sqrt(p) steps. For p=11, let m = ceil(sqrt(11)) = 4. Compute baby steps: 2^0=1, 2^1=2, 2^2=4, 2^3=8 (store these). Then compute giant steps: we want 2^k ≡ 3, so rewrite as 2^(im) ≡ 3 * (2^(-j))? Actually, we set k = i*m - j. Compute 2^(-m) mod 11: 2^4=16≡5, so inverse of 5 is 9 because 5*9=45≡1. Then compute giant steps: for i=0: 3*1=3, not in baby list. i=1: 3*9=27≡5, not in baby list. i=2: 3*9^2=3*81=243≡1? Actually 9^2=81≡4, 3*4=12≡1, not in baby list. i=3: 3*9^3=3*729=2187≡? 9^3=9*4=36≡3, 3*3=9, not in baby list. i=4: 3*9^4=3*9^3*9=3*3*9=81≡4, not in baby list. Wait, we need to match baby step value. Let's do properly: baby steps: j=0:1, j=1:2, j=2:4, j=3:8. Giant steps: compute a * (g^(-m))^i. g^(-m)=2^{-4}= inverse of 5 mod 11 is 9. For i=0: 3*1=3, not in baby. i=1: 3*9=27≡5, not. i=2: 3*9^2=3*81=243≡1, not. i=3: 3*9^3=3*729=2187≡? 9^3=9*9^2=9*4=36≡3, 3*3=9, not. i=4: 3*9^4=3*9^3*9=3*3*9=81≡4, not. i=5: 3*9^5=3*9^4*9=3*4*9=108≡9, not. Actually we missed: baby step j=2 gives 4, which matches i=4? But i=4 gives
5. How does the q-hockey-stick identity sum q-binomial coefficients along a diagonal?
The identity sums (i choose k)_q for i from k to n, giving (n+1 choose k+1)_q. For example, k=2, n=4: sum_{i=2}^4 (i choose 2)_q = (2 choose 2)_q + (3 choose 2)_q + (4 choose 2)_q = 1 + (1+q+q^2) + (1+q+2q^2+q^3+q^4) = 3+2q+3q^2+q^3+q^4. The right side (5 choose 3)_q = (1+q+q^2+q^3+q^4)(1+q+q^2+q^3)/(1+q) = 1+q+2q^2+2q^3+2q^4+q^5+q^6? That doesn't match. Wait, correct (5 choose 3)_q = (1-q^5)(1-q^4)(1-q^3)/((1-q^3)(1-q^2)(1-q)) = (1-q^5)(1-q^4)/((1-q^2)(1-q)) = (1+q+q^2+q^3+q^4)(1+q+q^2+q^3)/(1+q) = (1+q+2q^2+2q^3+2q^4+q^5+q^6). That is not equal to the sum. So the identity is actually sum_{i=k}^n q^{i-k} (i choose k)_q = (n+1 choose k+1)_q? Or the standard q-hockey-stick is sum_{i=k}^n q^{(i-k)(k+1)} (i choose k)_q = (n+1 choose k+1)_q? Let's check: For ordinary hockey-stick, sum_{i=k}^n (i choose k) = (n+1 choose k+1). For q-analogue, there is a weight. The correct identity is sum_{i=k}^n q^{(i-k)(k+1)} (i choose k)_q = (n+1 choose k+1)_q. For k=2, n=4, left: i=2: q^{0}*1=1; i=3: q^{1*3}=q^3 times (3 choose 2)_q = q^3(1+q+q^2)=q^3+q^4+q^5; i=4: q^{2*3}=q^6 times (4 choose 2)_q = q^
6. Use the Matrix-Tree Theorem to find the number of spanning trees of a complete graph K_4.
The Laplacian of K_4 is L = 3I − J, where J is the all-ones matrix. Deleting row and column 1 gives a 3×3 matrix with diagonal 3 and off-diagonal −1. Its determinant is 3*(3^2 − (−1)^2? Actually compute: matrix = [[3,-1,-1],[-1,3,-1],[-1,-1,3]]. Determinant = 3*(9−1) − (−1)*(−3+1) + (−1)*(1−3) = 3*8 − (−1)*(−2) + (−1)*(−2) = 24 − 2 + 2 = 24. So K_4 has 24 spanning trees (Cayley's formula gives 4^{4-2}=16? Wait, Cayley says n^{n-2}=16 for n=4, but that's for labeled trees on 4 vertices, not spanning trees of K_4? Actually, number of spanning trees of K_n is n^{n-2}=16 for n=4. So there is a mistake: the cofactor should be 16. Let me recalc: For K_4, Laplacian eigenvalues: 0,4,4,4. Product of nonzero eigenvalues /4 = 4*4*4/4=16. So cofactor is 16. My determinant above is wrong. Correct: matrix after deleting row1 col1 is [[3,-1,-1],[-1,3,-1],[-1,-1,3]]. Determinant: using formula for circulant: (3+1+1)*(3-(-1))^2? Actually compute: eigenvalues of this 3x3 matrix: λ = 3 + ω + ω^2? Better: The matrix is 3I - (J-I) = 4I - J? No. Let me compute directly: det = 3*(9-1) - (-1)*((-1)*(-1)-(-1
7. Construct a DFA for the reversal of the language accepted by the DFA with states {q0,q1}, alphabet {0,1}, transitions δ(q0,0)=q1, δ(q0,1)=q0, δ(q1,0)=q0, δ(q1,1)=q1, start q0, accept {q1}.
First, find L: the DFA accepts strings that end with an odd number of 0s? Actually, let's compute: q0 is start, accept q1. From q0 on 0 go to q1 (accept), on 1 stay q0. From q1 on 0 go to q0, on 1 stay q1. So L is set of strings with an odd number of 0s? Check: empty string not accepted. String '0' accepted, '00' not, '000' accepted. So L = {w | w has odd number of 0s}. Then L^R = same because reversal doesn't change number of 0s. So the DFA for L^R is the same DFA. But to construct systematically: reverse transitions: from q0 on 0 go to q1? Actually reverse: original δ(q0,0)=q1 becomes δ'(q1,0)=q0. Original δ(q0,1)=q0 becomes δ'(q0,1)=q0. Original δ(q1,0)=q0 becomes δ'(q0,0)=q1. Original δ(q1,1)=q1 becomes δ'(q1,1)=q1. New start state is set of accept states {q1}. New accept state is q0. So NFA has start q1, accept q0. But since it's symmetric, the DFA for L^R is same as original with start and accept swapped? Actually original DFA with start q0 and accept q1 accepts L. Swapping start and accept gives a DFA that accepts L^R? Not exactly because DFA must be deterministic. Here the re
8. Use Lagrange inversion to find the number of rooted labeled trees on n vertices from its generating function.
The generating function T(x) satisfies T = x * exp(T). Let T = x * phi(T) with phi(u)=exp(u). Lagrange inversion gives [x^n] T(x) = (1/n)[u^{n-1}] phi(u)^n = (1/n)[u^{n-1}] exp(n u) = (1/n) * n^{n-1}/(n-1)! = n^{n-2}/(n-1)!. Wait, that gives the coefficient for the exponential generating function? Actually careful: For ordinary generating function, T(x) = sum a_n x^n, the functional equation is T = x e^T. Then a_n = (1/n)[u^{n-1}] e^{n u} = (1/n) * n^{n-1}/(n-1)! = n^{n-2}/(n-1)!. But the number of rooted labeled trees is n^{n-1}, not n^{n-2}. So this gives the number of unrooted labeled trees? Let's check: For n=3, a_3 = 3^{1}/2! = 3/2 = 1.5, not integer. So this is not correct. Actually, the generating function for rooted labeled trees is exponential, not ordinary. For ordinary generating function, it counts unlabeled trees. So Lagrange inversion on T = x e^T gives the number of unlabeled rooted trees? But the numbers are not that. I need to correct: The ordinary generating function for unlabeled rooted trees satisfies T(x) = x * exp( sum T(x^k)/k ), not T = x e^T. So Lagrange inve
9. Show that the left quotient of a regular language by a regular language is regular by constructing a DFA.
Let L be regular accepted by DFA M = (Q, Σ, δ, q0, F). Let M be regular accepted by DFA N = (P, Σ, γ, p0, G). To accept M\L, build a DFA that simulates both. The idea: run N on a prefix to see if it is in M, then run M on the remaining suffix. But we need to guess the split. Instead, construct an NFA: states are pairs (p,q) where p in P, q in Q. Start state (p0, q0). On input a, transition to (γ(p,a), δ(q,a)). Accept if p ∈ G and q ∈ F? No, that would accept strings that are in M and L simultaneously. For left quotient, we want strings w such that there exists x in M with xw in L. So we need to simulate N on x (unknown) and then M on w. We can use ε-transitions: from start (p0,q0), we can nondeterministically choose to read x by moving only the N component? Actually, we can build an NFA that first guesses the end of x: from (p0,q0), we can follow transitions of N on ε? Better: construct an NFA where states are Q, start state is any state reachable from q0 by some string in M. Since M is regular, the set of such states is computable: it's the set of states reachable from q0 by strings
10. Give an example of the q-Vandermonde identity for small parameters.
Take m=2, n=2, k=2. The left side is (4 choose 2)_q = (1+q+q^2+q^3+q^4+q^5)/(1+q+q^2) = 1+q+2q^2+q^3+q^4. The right side sums j=0 to 2: j=0: q^{0} (2 choose 0)_q (2 choose 2)_q = 1*1*1=1; j=1: q^{1*(2-1+1)}=q^2 times (2 choose 1)_q (2 choose 1)_q = q^2 * (1+q)*(1+q)=q^2(1+2q+q^2)=q^2+2q^3+q^4; j=2: q^{2*(2-2+2)}=q^4 times (2 choose 2)_q (2 choose 0)_q = q^4*1*1=q^4. Sum: 1+q^2+2q^3+q^4+q^4 = 1+q^2+2q^3+2q^4, which matches after noting (4 choose 2)_q = 1+q+2q^2+q^3+q^4? Wait, correct value: (4 choose 2)_q = (1+q+q^2+q^3)(1+q+q^2+q^3+q^4+q^5)/((1+q+q^2)(1+q+q^2+q^3))? Actually standard formula: (4 choose 2)_q = (1-q^4)(1-q^3)/((1-q^2)(1-q)) = (1+q+q^2+q^3)(1+q+q^2)/(1+q) = (1+q+2q^2+q^3+q^4). So sum should equal that. Let's recompute: j=1 term: q^{1*(2-1+1)}=q^2, (2 choose 1)_q = 1+q, so product (1+q)^2 = 1+2q+q^2, times q^2 gives q^2+2q^3+q^4. j=2 term: q^{2*(2-2+2)}=q^4, (2 choose 2)_q=1, (2 choose 0)_q=1, so q^4. j=0: 1. Sum = 1 + q^2+2q^3+q^4 + q^4 = 1+q^2+2q^3+2q^4. But left side is 1+q+2q^2+q^3+q^4. They differ. Mistake: The correct q-Vandermonde has factor q^{j(m-k+j)}? Actually
11. How many NPN equivalence classes exist for 2-input Boolean functions?
There are 16 possible 2-input Boolean functions, but many are NPN equivalent. The distinct classes are: constant 0, constant 1, the identity function (x1), the negation of identity (NOT x1), the AND function, the OR function, the XOR function, and the XNOR function. However, note that constant 0 and constant 1 are not equivalent because output negation turns one into the other? Actually, negating output of constant 0 gives constant 1, so they are equivalent. Similarly, identity and NOT identity are equivalent via output negation. So for 2-input, the classes are: constants (0 and 1), single-variable functions (x1, NOT x1, x2, NOT x2) but these are all equivalent under permutation? Actually, x1 and x2 are equivalent under permutation, and NOT x1 is equivalent to x1 under output negation? Wait, careful. The standard NPN classes for 2-input are: constant, buffer (x1), NOT (NOT x1), AND, OR, XOR, XNOR. But buffer and NOT are not equivalent because output negation turns buffer into NOT, so they are in the same class? Actually, if you negate output of buffer (x1), you get NOT x1, so they ar
12. How many rooted trees are there on 3 unlabeled vertices? Rooted means one vertex is special.
For unlabeled rooted trees on 3 vertices, there are 4 possibilities: the root can have 0, 1, or 2 children. If root has 2 children, that's one tree. If root has 1 child, that child can have 0 or 1 child, giving two more. And root alone with no children is one more (but that's just a single vertex, not 3). Actually for 3 vertices, the rooted trees are: root with two children (star), root with a chain of two children (path), and root with one child that has one child (also a path but root at end). So there are 2 distinct rooted shapes? Let's count: The rooted trees on 3 unlabeled vertices are 2: the root with two children (star) and the root with a chain of two (path). But careful: In rooted trees, the root is distinguished, so the path has two possible roots (end or middle) but they are different rooted trees. So actually there are 4 rooted trees on 3 unlabeled vertices: root at end of path (two ways? No, unlabeled vertices so only shape matters). Standard count: rooted unlabeled trees on 3 vertices is 2? I recall the number of rooted trees on n unlabeled vertices is given by the Otte