Answers to review problems for the final


1. Let f(x) = 1/(1 - (x + x^2 + x^3)). Show that the coefficient of x^n is positive for each n, when we expand f(x) as a power series in x. What's a recurrence relation for the coefficient of x^n?

1A. The geometric series says f(x) = sum_n (x+x^2+x^3)^n. Each of those summands is a polynomial with positive coefficients, so when they're added together the result has positive coefficients.

The homework problem this is closest to is the stamp problem. In those terms, we're trying to get n cents postage, using a bunch of 1,2,3 cent stamps in any order (and order matters). Thought of that way, the ways to get such postage break three cases, based on the last stamp. That gives us the recurrence

F_n = F_(n-1) + F_(n-2) + F_(n-3).

(You can also get this from the equation f(x) = 1 + (x+x^2+x^3)f(x) and comparing coefficients.)


2. Let X = {1,2,3}, Y = {1,2,3,4,5,6}, and Doub : X -> Y be the doubling function. (1->2, 2->4, 3->6)

Can you find two functions f,g from Y -> X, not equal, such that f o Doub = g o Doub? (These are functions X->X.)

Can you find two functions f,g from Y -> X, not equal, such that Doub o f = Doub o g? (These are functions Y->Y.)

If you can, give an explicit example of an f and a g.

2A. Well, yes and no. That is to say, yes, and no. Here's a hint: f o Doub = g o Doub is really three equations, f(Doub(n)) = g(Doub(n)), n=1,2,3. That's not enough to determine a function from Y->X, which is six choices.

But we can (and must) be more specific. For the first one, let f:Y->X take everybody to 1, whereas g:Y->X takes even numbers (the image of Doub) to 1 -- this is what the equations tell us must be true -- and does something else with the odd numbers. For example, maybe g(1)=1, g(3)=3, g(5)=1.

(For the "no" part, if two numbers are equal after they're doubled, then they were already equal. So Doub(f(n)) = Doub(g(n)) implies f(n)=g(n).)


3. Let h(x) = f(1/x), where f(x) is the function from question #1.
  • Is h(x) = 1 + O(1)?
  • Is h(x) = 1 + O(1/x)?
  • Is h(x) = 1 + O(1/x^2)?
  • 3A. Let's rewrite as "Is h(x)-1 = O(1)?" and so on.

    Then h(x)-1 = f(1/x) - 1 = 1/(1 - 1/x - 1/x^2 - 1/x^3) - 1 = (1/x + 1/x^2 + 1/x^3) / (1 - 1/x - 1/x^2 - 1/x^3).
    At this point you can take the biggest terms in the top (that's 1/x) and in the bottom (that's 1) to say this is O(1/x), but not O(1/x^2). If you don't like that, multiply top and bottom by x^3 and do it then.


    4. Let X be the numbers 1...m, Y the numbers 1...n. How many functions f are there from X to Y such that
  • 1+1=2? (I.e. how many functions, period?)
  • f is "strongly order-preserving", so i less than j implies f(i) less than f(j)?
  • f is "weakly order-preserving", so i less than j implies f(i) less than or equal to f(j)?
  • f is 1:1 and strongly order-preserving?
  • f is 1:1 and not strongly order-preserving?
  • f is strongly order-preserving and not 1:1?
  • f is weakly order-preserving and not 1:1?
  • 4a. How many functions, indeed. n^m.
    4b. These fs are determined by their images, which are m-element subsets of Y. So (n choose m).
    4c. These fs are determined by their images-plus-multiplicities, i.e. for each element of Y we keep track not only of whether it's hit but how many times. The total number of hits is m, so it's a stars-and-bars question, with m stars and n-1 bars. Therefore we get (m + n-1 choose m).
    4d. All the strongly order-preservings are 1:1. So this is just (n choose m) again.
    4e. This is the number of 1:1s, which we counted to be (n choose m)m! early in the class, minus the number of 1:1 and strongly order-preservings, so it's (n choose m)(m! - 1).
    4f. Zero.
    4g. This is (4c) - (4b), since weakly order-preserving and 1:1 is exactly strongly order-preserving.


    5. Same X and Y as in #4, but now also have Z, with p elements, where p is prime. Given 1:1 functions f:X->Y and g:Y->Z, we get a function h = g o f from X to Z.

    If you're only told h, how many possibilities are there for f? How many for g? How many for the pair (f,g)?

    5A.

  • If we're given f and h, there is always a g such that h = g o f. So this is just the number of 1:1 f's, which is (n choose m)m!.
  • We know that g has to hit everything h hits. So let's pick which things in Y hit the image of h -- that's (n choose m) choices. Then we pick a way to correspond them; that's m! choices. Then we have to map the rest of Y (that's n-m elements remaining) 1:1 to the rest of Z (that's p-m remaining). Having done all that, we get (n choose m) m! (p-m choose n-m) (n-m)! possible g's.
  • Each one of those g's has a unique f to go with it such that h = g o f. So we get the same number of pairs as we did just g's.

  • 6. Let P have n elements, Q have n-2. How many functions are there from P onto Q?

    6A. Let's warm up by thinking about the easier cases, n & n, or n & n-1.

    If |Q|=n, then we're just thinking about permutations -- n!.

    If |Q|=n-1, then somebody in Q is being hit twice. There's (n-1) possibilities for who it might be. Once we know that, let's ask which two elements in P are hitting that guy. That's (n choose 2) possibilities. With them out of the way we're back to corresponding the remaining n-2 elements of each set. So in all it's (n-1) (n choose 2) (n-2)!.

    Now for |Q|=n-2. These maps fail to be 1:1 in two different ways, from the extra two elements: we could get two elements of Q with two preimages each, or one guy with a full three preimages.

    Let's do the three preimages case first. Following the previous analysis, it's (n-2) (n choose 3) (n-3)!.

    For the two guys with two preimages each, we first pick the two guys: that's (n-2 choose 2). Then we pick the preimages of one: that's (n choose 2). Then of the other: that's (n-2 choose 2), since they can't overlap. Then we correspond the remaining n-4. So it's (n-2 choose 2) (n choose 2) (n-2 choose 2) (n-4)!.

    For all the ontos, we add these two numbers.


    7. Prove that every even prime is the sum of two odd numbers.

    7A. 2 = 35 + (-33).


    8. Let p,q be prime, p less than or equal to q.
  • If q+p is prime, what are all the possibilities for p?
  • If q+p,q-p are both prime, what are all the possibilities for q?
  • 8A. If p and q are odd, then p+q is even. So it's not prime (since it's not 2). So for the first part, we find out that p is 2.
    For the second, look at q-2, q, q+2 mod 3. One of them is congruent to 0 mod 3. For it to be prime, it's gotta be 3. That leaves the possibilities of -1,1,3 or 1,3,5 or 3,5,7, and only the third one works.


    9. Let p,q be prime, m and n be nonnegative integers. If p^m = q^n + 1, what can you say about p and q? (Not a very well-defined question -- nothing this vague will be on the final -- but you should still think about it.)

    For example, 3^2 = 2^3 + 1 since 9 = 8+1.

    9A. Again, if p and q are both odd, then so are their powers, and this can't happen. So one of them must be even, hence 2. This is all I was expecting for this one.

    Hard theorem: in this case the exponent on the other number is 1.

    Not so hard: if we're looking at p = 2^n + 1, then n itself has to be a power of 2. (Not every power works: actually, it's conjectured that only n=0,1,2,3,4 work.) These are "Fermat primes."

    Also not so bad: if we're looking at q = 2^n - 1, then n itself has to be prime. These are "Mersenne primes" (lots more about them if you follow the link).