# Find an ordinary generating function whose $a_r = 3r + 7$

Problem

Find an ordinary generating function whose coefficient $a_r = 3r + 7$.

My Solution

$$g(x)=1+x+x^2+x^3+\cdots=\frac{1}{1-x}$$

$$7\times g(x)=7+7x+7x^2+7x^3=\frac{7}{1-x}$$

$$g'(x)=0+1+2x+3x^2+4x^3+\cdots=\frac{1}{(1-x)^2}$$

$$3x\times g'(x)=0+3x+3\times2x^2+3\times3x^3+3\times4x^4+\cdots=\frac{3x}{(1-x)^2}$$

$$[3x\times g'(x)]+[7\times g(x)]=7+(3+7)x+(3\times2+7)x^3+(3\times4+7)x^4=\frac{3x}{(1-x)^2}+\frac{7}{1-x}$$

Answer

$$\frac{3x}{(1-x)^2}+\frac{7}{1-x}$$

This answer concurs with what the book has in the back (Applied Combinatorics (6th Edition) by Alan Tucker), but I just want to make sure that it's okay to solve $3x\times g'(x)$ and $7\times g(x)$ separately the way I did and then add them together.

Could someone confirm if the logic of my solution is solid?

By the way, I know that there are summation ways of solving these sort of problems, but that's not what was taught to us, so I'm sticking to this more simpler approach.

• Separately and then add is fine. – André Nicolas May 24 '16 at 5:04
• @AndréNicolas Thanks. – B.K. May 24 '16 at 5:09