 To find the number of permutations for a multi-set with different types of elements, possibly with restrictions on the use of the elements, we find the exponential generating functions for the sets consisting of a single type of element with the same restrictions. Then the product is an exponential generating function for the permutations on the original multi-set g. In principle, that's all we need to do. In practice there's a lot of steps, so let's take a look at a more involved example. Let's find the number of permutations of two elements a and b, where a has to be used one or two times and b has to be used an odd number of times. Since a has to be used one or two times, its generating function is since b has to be used an odd number of times, its generating function is and we can get that if we take our Taylor series for e to the x, for e to the minus x, subtract them and divide by two. And so our exponential generating function for the multi-set will be the product, which we can expand. To find the number of n permutations, we need to rewrite this as a single series. Since we're treating this as a formal power series, we can do term-wise operations provided all of our series start at the same value and all the terms we're adding have the same degree. So we have our power series for e to the x and our power series for x e to the x. As a formal power series, we can just move that extra factor of x inside the summation. But now our terms have different degrees. This is x to the i and this is x to the i plus one. And so we want to re-index using j equals i plus one. So i equals j minus one and i equals zero corresponds to j equal to one. And so rewriting our series gives us... Now, while this is indexed in j, the name of the index variable doesn't actually matter. So we'll rename it i and get our power series for x e to the x. And so we can replace that in our expression. Similarly, e to the negative x will be... And so x e to the negative x will be... Again, re-indexing with j equal to i plus one and so i equals j minus one gives us... And re-naming our index variable gives us... And replace. We also need a one-half x squared e to the x, which will be... We'll re-index and re-name at the end. One-half x squared e to the negative x will be... And let's make one simplification. Negative one to the power j minus two is really the same thing as... And negative one squared is just one, so this simplifies. Now we need to combine our coefficients. While every term has degree i, the first two series start at x equals one, so we need to rewrite them to start at x equals two. And we can do this by splitting off the first few terms. Remember, you can always start later. So the sum from one to infinity will split off the i equals one term and get the series from two to infinity. And we'll simplify. Likewise for the other term, we'll split off the first term and then we'll get the series from two to infinity and simplify. So, like I said, this is kind of a long problem, but our next step, now that all of our series begin in the same place, they all have the same terms, we can add the coefficients and the x plus negative x those will cancel. And now that we have a single series, let's move that factor of one-half into the summation. Now, while this is our generating function, we need to write our coefficients in the form gi over i factorial to find gi, the number of i permutations. For that, we'll need to do a little bit more algebra. So our coefficients are these and we need to get an i factorial in the denominator. So here, we're missing a factor of i, so we'll multiply by i over i to get. Here, we're missing another factor of i. Here, our factorial begins at i minus two, so we need to include i and i minus one to get and we'll move that two into the numerator and likewise for the last term. And so we get and let's split off that factor of one over i factorial to get and we'll consolidate these factors of negative one. So after all that work, we get our generating function and the coefficients give us the number of n permutations. Now, since our series begins at i equals two, that means our first two coefficients are actually zero. So the number of n permutations is zero if n equals zero and zero if n equals one. For n greater than one, the number of n permutations will be this coefficient, which we'll express in terms of n. Now, this is a lot of work and it would be a shame to get the wrong answer because we made an algebraic mistake. So let's check this. Since a has to be used one or two times, there are no zero permutations. We could use one a, but since b has to be used an odd number of times, we have to use at least one b as well and so there are no one permutations either. So let's pick a random number. How about four? And so the four permutations, a has to be used one or two times. So if we use a one time, we get and while we could use a two times, we would also then have to use b two times and we are required to use b an odd number of times. So these are the only four permutations. So there's four of them. Now, if we use our formula for n equals four, our formula gives us four permutations. And while this isn't a proof that our formula is correct, it does suggest that we haven't made any serious mistakes in algebra.