✔ 最佳答案
Remember the exponents in a generating function reflect the domain allowed for each quantity/variable in question.
The generating function for x is
(z^0 + z^1 + z^2 + ...) = 1/(1 - z).
The generating function for 2y is
(z^0 + z^2 + z^4 + ...) = 1/(1 - z^2).
Thus, the generating function for the equation is
A(z) = [1/(1 - z)] * [1/(1 - z^2)].
Now, we find the coefficient of x^n from this.
A(z) = [1/(1 - z)] * [1/(1 - z^2)]
= (1 - z)^(-2) * (1 + z)^(-1)
= [sum(k=0 to infinity) C(1+k,k)z^k] * [sum(k=0 to infinity) (-1)^k z^k]
= [sum(k=0 to infinity) (1+k) z^k] * [sum(k=0 to infinity) (-1)^k z^k]
By using the distributive property, the coefficient of z^n is
a_n = sum(i = 0 to n) (-1)^i * (1 + (n - i))
= sum(i = 0 to n) (-1)^i * ((n + 1) - i).
= (n + 1) * [sum(i = 0 to n) (-1)^i] + [sum(i = 0 to n) (-1)^(i+1) * i].
If n is even, then a_n = (n+1) + [1 - 2 + 3 - ... + (-1)^(n+1) * n].
However, writing n = 2k,
1 - 2 + 3 - ... + (-1)^(2k+1) * (2k)
= (1 + 3 + 5 + ... + (2k - 1)) - (2 + 4 + ... + 2k)
= k^2 - 2 * (1 + 2 + ... + k)
= k^2 - (k(k+1))
= -k
= -n/2
Thus, a_n = (n+1) + (-n/2) = (n+2)/2 if n is even.
---------
If n is odd, we get 0 + [1 - 2 + 3 - ... + (-1)^(n+1) * n]
However, writing n = 2k+1,
1 - 2 + 3 - ... + (-1)^(2k+2) * (2k+1)
= 1 - 2 + 3 - ... + (2k+1)
= (1 + 3 + 5 + ... + (2k + 1)) - (2 + 4 + ... + 2k)
= (k+1)^2 - 2 * (1 + 2 + ... + k)
= (k+1)^2 - (k(k+1))
= k+1.
= (n-1)/2 + 1
= (n+1)/2
Thus, a_n = 0 + (n+1)/2 = (n+1)/2 if n is odd.
--------
In summary,
a_n = (n+2)/2 if n is even.
a_n = (n+1)/2 if n is odd.
I hope this helps!